Skip to content
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

[Mailer] Catch missing scheme in DSN #31993

Merged
merged 1 commit into from Jun 23, 2019

Conversation

Projects
None yet
5 participants
@derrabus
Copy link
Contributor

commented Jun 11, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

The Symfony\Component\Mailer\Transport::createTransport() method parses and validates a passed DSN. I noticed that we never check if the DSN contains a valid scheme, but we always assume that the scheme is present in then parse result. If someone passes a DSN without a scheme to that method, they would almost certainly run into a PHP notice.

This PR makes sure that a scheme is present in the URL and throws a proper exception otherwise.

@derrabus derrabus changed the title [Mailer] Catch missing scheme in DSN. [Mailer] Catch missing scheme in DSN Jun 11, 2019

Show resolved Hide resolved src/Symfony/Component/Mailer/Transport.php Outdated

@derrabus derrabus force-pushed the derrabus:bugfix/check-for-scheme branch from c00966a to 3eba36c Jun 11, 2019

@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Jun 11, 2019

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Jun 23, 2019

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 3eba36c into symfony:4.3 Jun 23, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

nicolas-grekas added a commit that referenced this pull request Jun 23, 2019

minor #31993 [Mailer] Catch missing scheme in DSN (derrabus)
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer] Catch missing scheme in DSN

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

The `Symfony\Component\Mailer\Transport::createTransport()` method parses and validates a passed DSN. I noticed that we never check if the DSN contains a valid scheme, but we always assume that the scheme is present in then parse result. If someone passes a DSN without a scheme to that method, they would almost certainly run into a PHP notice.

This PR makes sure that a scheme is present in the URL and throws a proper exception otherwise.

Commits
-------

3eba36c [Mailer] Catch missing scheme in DSN.

@derrabus derrabus deleted the derrabus:bugfix/check-for-scheme branch Jun 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.