This repository was archived by the owner on Jan 30, 2020. It is now read-only.
Replace error handler with error_get_last() function #229
Open
flancer64 wants to merge 1 commit intozendframework:masterfrom
Open
Replace error handler with error_get_last() function #229flancer64 wants to merge 1 commit intozendframework:masterfrom
flancer64 wants to merge 1 commit intozendframework:masterfrom
Conversation
`error_get_last()` usage instead of error handler replacement.
Member
|
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at laminas/laminas-mail#15. |
Member
|
This repository has been moved to laminas/laminas-mail. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi, guys.
I just found that
mail()function does not generate the proper error that can be handled byhandleMailErrors()method ("Temporary error handler for PHP native mail()" as pointed in the phpdoc). I have an msmtp as email agent with following settings inphp.ini:I have an error in
\Zend\Mail\Transport\Sendmail::mailHandlerifin
As I see, there is a conflict between
--read-envelope-fromoption ofmsmtpand-f'sender@email.com'parameter ofmailfunction. So,mailfunction returnsfalsein this case.But this code does not handle the error as expected. The breakpoint in
handleMailErrorsmethod does not activated when error occurs (I have PHP 7.2.19 & PHPStorm 2019.1.3).I found that
error_get_last()function may help in this case.In addition I think we should not throw an exception if
$resultistrue.So, I suppose, the final code for
mailHandlershould be the following:Sorry, my qualification is not enough to complete all items you want to see here (regression test, CHANGELOG.md, etc.). But I hope my point of view may be useful.
Have a good day!