Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:6.3fromkgnblg:6.3
Sep 6, 2023

Conversation

@kgnblg
Copy link
Contributor

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
Tickets---
LicenseMIT
Doc PR---

This PR contains a basic fix of a bug in SymfonyMailer component (Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport class).

If we useEsmtpTransport like the given example, it needs to throw TransportException which has been defined in thehandleAuth() ofEsmtpTransport class. (Because we calledsetAuthenticators() with empty array and the function emptied the authenticators. We can imagine that we forget to set authenticators.)

$stream = new DummyStream();$transport = new EsmtpTransport(stream: $stream);$transport->setUsername('testuser');$transport->setPassword('p4ssw0rd');$transport->setAuthenticators([]);....$transport->send(...);

This code piece needs to throw following TransportException with code 504;

Failed to find an authenticator supported by the SMTP server, which currently supports: "plain", "login", "cram-md5", "xoauth2".

However it shows a PHP Error;

Undefined variable $code

I included a unit test functiontestConstructorWithEmptyAuthenticator() inside of theEsmtpTransportTest class with a fix of the problem.

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
Copy link

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:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

Copy link
Member

@fabpotfabpot left a 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
Copy link
ContributorAuthor

I checked it for 5.4. This bug does not exist on 5.4.

@fabpot
Copy link
Member

Thank you@kgnblg.

@fabpotfabpot merged commit29f427f intosymfony:6.3Sep 6, 2023
continue;
}

$code =null;
Copy link
Member

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 ?

Copy link
ContributorAuthor

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please do :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Here it is:#51581 :)

xabbuh reacted with heart emoji
fabpot added a commit that referenced this pull requestSep 7, 2023
…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
@fabpotfabpot mentioned this pull requestSep 30, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@xabbuhxabbuhxabbuh approved these changes

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

5 participants

@kgnblg@carsonbot@fabpot@stof@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp