8000 [Mailer] Catch missing scheme in DSN by derrabus · Pull Request #31993 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mailer] Catch missing scheme in DSN #31993

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

Merged
merged 1 commit into from
Jun 23, 2019

Conversation

derrabus
Copy link
Member
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
@derrabus derrabus force-pushed the bugfix/check-for-scheme branch from c00966a to 3eba36c Compare June 11, 2019 12:30
@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 3eba36c into symfony:4.3 Jun 23, 2019
nicolas-grekas added a commit that referenced this pull request Jun 23, 2019
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 bugfix/check-for-scheme branch June 23, 2019 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0