Skip to content

IMAP: there's no way to check if a IMAP\Connection is still open #10051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
underdpt opened this issue Dec 5, 2022 · 2 comments
Closed

IMAP: there's no way to check if a IMAP\Connection is still open #10051

underdpt opened this issue Dec 5, 2022 · 2 comments

Comments

@underdpt
Copy link

underdpt commented Dec 5, 2022

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

@cmb69
Copy link
Member

cmb69 commented Dec 5, 2022

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

In the latter case, there should be no ValueError: IMAP\Connection is already closed, though. An application can handle the former case, but still it might be reasonable to introduce an imap_is_open() function.

@Girgias
Copy link
Member

Girgias commented Nov 20, 2023

Fixed via #10094

@Girgias Girgias closed this as completed Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants