mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Resolve Issue #70
This commit is contained in:
parent
52dadc46f3
commit
801e3f8e2b
1 changed files with 17 additions and 6 deletions
|
|
@ -100,16 +100,27 @@ class ResponseCollection extends \MailSo\Base\Collection
|
|||
|
||||
foreach ($this as $oResponse) {
|
||||
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType &&
|
||||
$sStatus === $oResponse->StatusOrIndex && 5 === count($oResponse->ResponseList))
|
||||
$sStatus === $oResponse->StatusOrIndex && 5 <= count($oResponse->ResponseList))
|
||||
{
|
||||
try
|
||||
{
|
||||
$sFullNameRaw = $oResponse->ResponseList[4];
|
||||
if (\is_array($sFullNameRaw)) {
|
||||
$sFullNameRaw = "[{$sFullNameRaw[0]}]";
|
||||
/**
|
||||
* A bug in the parser converts folder names that start with '[' into arrays,
|
||||
* and subfolders are in $oResponse->ResponseList[5+]
|
||||
* https://github.com/the-djmaze/snappymail/issues/1
|
||||
* https://github.com/the-djmaze/snappymail/issues/70
|
||||
*/
|
||||
$sFullNameRaw = \array_slice($oResponse->ResponseList, 4);
|
||||
foreach ($sFullNameRaw as &$name) {
|
||||
if (\is_array($name)) {
|
||||
$name = "[{$name[0]}]";
|
||||
} else if (!\is_string($name)) {
|
||||
$name = '';
|
||||
}
|
||||
}
|
||||
if (!\is_string($sFullNameRaw)) {
|
||||
\error_log('ResponseCollection::getFoldersResult: invalid string ' . \var_export($sFullNameRaw, true));
|
||||
$sFullNameRaw = \implode('', $sFullNameRaw);
|
||||
if (!\strlen($sFullNameRaw)) {
|
||||
\error_log('ResponseCollection::getFoldersResult: invalid string ' . \var_export($oResponse->ResponseList[4], true));
|
||||
continue;
|
||||
}
|
||||
$oFolder = new Folder($sFullNameRaw,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue