php-imap
php-imap copied to clipboard
[BUG] Fatal error: Uncaught ValueError: IMAP\Connection is already closed
- PHP IMAP version: 5.0.0
- PHP Version: 8.1.10
PHP Fatal error: Uncaught ValueError: IMAP\Connection is already closed in .../PhpImap/Mailbox.php:479 Stack trace: #0 .../PhpImap/Mailbox.php(479): imap_ping() #1 .../PhpImap/Mailbox.php(544): PhpImap\Mailbox->hasImapStream() #2 .../PhpImap/Mailbox.php(187): PhpImap\Mailbox->disconnect()
I'm getting the same since the upgrade to PHP 8.1.11
Probably because of this: https://www.php.net/ChangeLog-8.php
Version 8.1.10
IMAP: Fixed bug GH-9309 (Segfault when connection is used after imap_close()).
To me, this happens because I'm calling unset($mailbox) which calls $mailbox->destruct() which will try to close the IMAP connection which I've already closed by invoking $mailbox->disconnect().
I can confirm this happens also with version 8.1.13.
Should be fixed in version 5.0.1.
And what about: public static function ping($imap_stream): bool in Imap class?