This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Zend\Mail\Protocol\Smtp does not reset protected $auth after disconnect #4690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use an offline worker process to process sending out of emails, as such keeping a connection open too long can cause issues with timeouts. Therefore I have my worker disconnect when it hits an internal timeout. Example:
When it re-connects and attempts to send out an email, it fatally errors: Fatal error: Already authenticated for this session in /var/www/vendor/zendframework/zendframework/library/Zend/Mail/Protocol/Smtp.php on line 368
This is due to when the disconnect portion of the mail code is hit, it does not actually reset the $auth flag. As you can see from a greg command there is no place in where the flag is set back to false and is always true if you keep the same instance around and reuse it.
This change does 2 things:
We need both of these for simple reasons; $auth because we need to manually set it since we actually never really call any of the methods and secondly $sess because otherwise the ->quit() method would never actually make it into the block.