php-imap
php-imap copied to clipboard
Case sensitive \NoSelect flag check doesn't work for Gmail
Describe the bug
This is more a bug with Gmail but it returns folders with the flag "\Noselect" instead of "\NoSelect" so the Folder class does not get the no_select attribute set correctly.
I don't know if this would cause problems anywhere else, but maybe the parseAttributes method could check for flags with case insensitive comparisons.
Code to Reproduce The troubling code section which produces the reported bug.
$client = (new ClientManager)->make($config);
$client->connect();
$client->getFolders(false);
Expected behavior
Folders with the flag "\Noselect" should have the no_select attribute set to true.
Responses Fetching the folders with the imap connection:
[
"[Gmail]" => [
"delimiter" => "/",
"flags" => [
"\HasChildren",
"\Noselect",
],
],
"[Gmail]/All Mail" => [
"delimiter" => "/",
"flags" => [
"\All",
"\HasNoChildren",
],
],
]
The folders array returned by php-imap:
[
Webklex\PHPIMAP\Folder {
+path: "[Gmail]",
+name: "[Gmail]",
+full_name: "[Gmail]",
+children: Webklex\PHPIMAP\Support\FolderCollection {
all: [],
},
+delimiter: "/",
+no_inferiors: false,
+no_select: false,
+marked: false,
+has_children: true,
+referral: false,
+status: ? array,
},
Webklex\PHPIMAP\Folder {
+path: "[Gmail]/All Mail",
+name: "All Mail",
+full_name: "[Gmail]/All Mail",
+children: Webklex\PHPIMAP\Support\FolderCollection {
all: [],
},
+delimiter: "/",
+no_inferiors: false,
+no_select: false,
+marked: false,
+has_children: false,
+referral: false,
+status: ? array,
},
]
Desktop / Server (please complete the following information):
- OS: MacOS Sonoma
- PHP: 8.2
- Version: 5.5.0
- Provider Gmail
+1 Seeing this behavior as well with all Google/Gmail ids.