From b658b79264c9d2e34e45bf7ff3306a0d44b3fb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Tue, 24 Aug 2021 23:20:27 +0200 Subject: [PATCH] [snappymail] Remove some more overuse of trim() The FolderCreate() function also misses using trim() sometimes on $sFolderParentFullNameRaw, so this should be more correct as well. --- .../v/0.0.0/app/libraries/MailSo/Mail/MailClient.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index 7934cfdb5..746115826 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -2084,26 +2084,27 @@ class MailClient public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullNameRaw = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self { $sFolderNameInUtf8 = \trim($sFolderNameInUtf8); + $sFolderParentFullNameRaw = \trim($sFolderParentFullNameRaw); if (0 === \strlen($sFolderNameInUtf8)) { throw new \MailSo\Base\Exceptions\InvalidArgumentException; } - if (0 === \strlen($sDelimiter) || 0 < \strlen(\trim($sFolderParentFullNameRaw))) + if (0 === \strlen($sDelimiter) || 0 < \strlen($sFolderParentFullNameRaw)) { - $aFolders = $this->oImapClient->FolderList('', 0 === \strlen(\trim($sFolderParentFullNameRaw)) ? 'INBOX' : $sFolderParentFullNameRaw); + $aFolders = $this->oImapClient->FolderList('', 0 === \strlen($sFolderParentFullNameRaw) ? 'INBOX' : $sFolderParentFullNameRaw); if (!$aFolders) { // TODO throw new \MailSo\Mail\Exceptions\RuntimeException( - 0 === \strlen(trim($sFolderParentFullNameRaw)) + 0 === \strlen($sFolderParentFullNameRaw) ? 'Cannot get folder delimiter' : 'Cannot create folder in non-existen parent folder'); } $sDelimiter = $aFolders[0]->Delimiter(); - if (0 < \strlen($sDelimiter) && 0 < \strlen(\trim($sFolderParentFullNameRaw))) + if (0 < \strlen($sDelimiter) && 0 < \strlen($sFolderParentFullNameRaw)) { $sFolderParentFullNameRaw .= $sDelimiter; }