Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Mailer] bug - fix EsmtpTransport variable $code definition#51568
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
the variable $code defined in the foreach loop, if there is no authenticators,then the $code will not be defined and therefore the following TransportExceptiongives a PHP error.the use-case defined as a unit test in EsmtpTransportTest class.
carsonbot commentedSep 5, 2023
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
fabpot left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
For 5.4?
kgnblg commentedSep 5, 2023
I checked it for 5.4. This bug does not exist on 5.4. |
fabpot commentedSep 6, 2023
Thank you@kgnblg. |
| continue; | ||
| } | ||
| $code =null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldn't we still reset it on each iteration of the loop ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yes, you are right. I added it in my forked branch should I create a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please do :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Here it is:#51581 :)
…revent wrong exception codes (kgnblg)This PR was merged into the 6.3 branch.Discussion----------[Mailer] bug - reset $code variable each iteration for prevent wrong exception codes| Q | A| ------------- | ---| Branch? | 6.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | ---| License | MIT| Doc PR | ---Follow up PR of#51568 to reset `$code` variable for each iteration to have correct `TransportException` code.(Note: This bug does not exist in version 5.4)Commits-------ce4bc8c [mailer] reset $code variable each iteration for prevent wrong codes to be used
This PR contains a basic fix of a bug in SymfonyMailer component (
Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportclass).If we use
EsmtpTransportlike the given example, it needs to throw TransportException which has been defined in thehandleAuth()ofEsmtpTransportclass. (Because we calledsetAuthenticators()with empty array and the function emptied the authenticators. We can imagine that we forget to set authenticators.)This code piece needs to throw following TransportException with code 504;
However it shows a PHP Error;
I included a unit test function
testConstructorWithEmptyAuthenticator()inside of theEsmtpTransportTestclass with a fix of the problem.