-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Gracefully handle possible non-array return value of imap_getmailboxes #372
Conversation
Done
but, as I've stated before, in the C code the result is nullable, I think it would be better to check diffs between errors before and after the call, because the result value is not a valuable indicator of failure.
This was the warning for the invalid variable passed as countable to foreach, with some variable dump just ($this->resource, $this->server), and it looks fine. |
I've read carefully your reply but honestly I have almost-zero knowledge of C and php-src
I don't get what you mean with this
Without the current design, how would you get both lazy-loading and crappy imap extension error handling?
What do you mean by "it looks fine"? If you have any suggestion on how to improve this, please PR against my branch or this library. Last but not least, fa sempre piacere trovare un connazionale preparato 😉 |
As we are not able to tell the difference between a null error and null result, we should use another source of truth for error guessing
Here I'm just saying that throwing exceptions from private methods hides the behaviour of the explicit/public method in the first place, the problem is not the exception/error logic
it looks fine because from the original issue someone noticed a "strange" server endpoint, but from the dump everything looks fine
If you know two or three things you are good to go Some sources about the php internals http://www.phpinternalsbook.com/ Ci sono tanti bravi connazionali, purtroppo non ci esponiamo troppo alla pubblica gogna. ;) |
So, AFAICT there is nothing we can improve in this imap-extension flaw, and this PR is everything we can get to handle the issue. Nevertheless I would like at least to:
Could you describe here:
So I can reproduce it in a dedicated real email account? |
GMail
Nope NDA, sorry is my company email.
I went onward testing the issue here, the problem is the missing connection due to a timeout (in my case everything greater than ~350s from the authentication to the very first IMAP message). I've used this code as a proxy for a valid connection /**
* @return ConnectionInterface
*
* @throws AuthenticationFailedException
*
*/
public function getConnection() : ConnectionInterface {
if($this->connection && $this->connection->ping()) {
return $this->connection;
}
$this->connection = $this->server->authenticate($this->username, $this->password);
return $this->connection;
} |
We should investigate |
Reference: #134
@robertodormepoco please can you checkout my branch imap_getmailboxes_non_array and report here the full exception error message, so I can better document what happens?