Description
After #9309 (landed on 8.1.10) any attempt to close an already closed imap connection results on a ValueError: IMAP\Connection is already closed exception being thrown.
imap_ping() also throws the same exception, so there's no way to check if a connection is still open (it might be closed by another piece of code, or because the server closed the connection while processing a long task).
There should be a safe way to check if a IMAP\Connection is still open.
Related: barbushin/php-imap#680
PHP Version
PHP >= 8.1.10
Operating System
Ubuntu 22.04 / Windows 10&11