File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -476,7 +476,17 @@ public function getImapStream(bool $forceConnection = true)
476476
477477 public function hasImapStream (): bool
478478 {
479- return (\is_resource ($ this ->imapStream ) || $ this ->imapStream instanceof \IMAP \Connection) && \imap_ping ($ this ->imapStream );
479+ try {
480+ return (\is_resource ($ this ->imapStream ) || $ this ->imapStream instanceof \IMAP \Connection) && \imap_ping ($ this ->imapStream );
481+ } catch (\Error $ exception ) {
482+ // From PHP 8.1.10 imap_ping() on a closed stream throws a ValueError. See #680.
483+ $ valueError = '\ValueError ' ;
484+ if (class_exists ($ valueError ) && $ exception instanceof $ valueError ) {
485+ return false ;
486+ }
487+
488+ throw $ exception ;
489+ }
480490 }
481491
482492 /**
You can’t perform that action at this time.
0 commit comments