php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

"Empty response" when an empty folder is scanned

Open rskrzypczak opened this issue 1 year ago • 1 comments

Describe the bug When I try to use getByUidGreater() or similar on a folder that is empty and does not contain any email messages, I get an error.

Code to Reproduce $limit = 10; $uid = 0; $name = 'INBOX.Archive'; $folder = $this->client->getFolderByPath($name); $folder->query()->limit($limit)->getByUidGreater($uid);

Webklex\\PHPIMAP\\Exceptions\\ResponseException: Command failed to process:
Causes:
	- Empty response
Error occurred in vendor/webklex/php-imap/src/Exceptions/ResponseException.php:53
Stack trace:
#0 vendor/webklex/php-imap/src/Connection/Protocols/Response.php(318): Webklex\\PHPIMAP\\Exceptions\\ResponseException::make()
#1 vendor/webklex/php-imap/src/Connection/Protocols/Response.php(308): Webklex\\PHPIMAP\\Connection\\Protocols\\Response->validate()
#2 vendor/webklex/php-imap/src/Query/Query.php(525): Webklex\\PHPIMAP\\Connection\\Protocols\\Response->validatedData()
#3 vendor/webklex/php-imap/src/Query/Query.php(573): Webklex\\PHPIMAP\\Query\\Query->filter()
#4 app/Mail/Connections/Imap.php(163): Webklex\\PHPIMAP\\Query\\Query->getByUidGreater()

Expected behavior This exception should not occur

Desktop / Server (please complete the following information):

  • OS: [e.g. Debian 11]
  • PHP: [e.g. 8.3]
  • Version [e.g. v5.5.0]

rskrzypczak avatar Jun 10 '24 16:06 rskrzypczak