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

[BUG] Fatal error: Uncaught ValueError: IMAP\Connection is already closed

Open eddi13 opened this issue 3 years ago • 3 comments

  • 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()

eddi13 avatar Sep 23 '22 10:09 eddi13

I'm getting the same since the upgrade to PHP 8.1.11

ghnp5 avatar Oct 19 '22 08:10 ghnp5

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()).

ghnp5 avatar Oct 19 '22 08:10 ghnp5

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().

ghnp5 avatar Oct 19 '22 08:10 ghnp5

I can confirm this happens also with version 8.1.13.

underdpt avatar Dec 05 '22 13:12 underdpt

Should be fixed in version 5.0.1.

Sebbo94BY avatar Dec 05 '22 15:12 Sebbo94BY

And what about: public static function ping($imap_stream): bool in Imap class?

applibs avatar Jan 15 '23 07:01 applibs