8000 [Mailer] Fixed 'verify_peer' option in mailer DSN being ignored by snake-4 · Pull Request #37961 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mailer] Fixed 'verify_peer' option in mailer DSN being ignored #37961

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
Aug 31, 2020
Merged

[Mailer] Fixed 'verify_peer' option in mailer DSN being ignored #37961

merged 1 commit into from
Aug 31, 2020

Conversation

snake-4
Copy link
Contributor
@snake-4 snake-4 commented Aug 27, 2020
Q A
Branch? 5.1
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

The mailer DSN option 'verify_peer' was being ignored because $dsn->getOption('verify_peer', true) was returning a string and thus NOT operator on it was always resulting in false. I propose changing the line where it is used with a filter_var call with the FILTER_VALIDATE_BOOLEAN as the filter parameter to overcome this issue.

Copy link
Member
@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

Can you add a test case to cover this fix?

@snake-4
Copy link
Contributor Author
snake-4 commented Aug 27, 2020

Can you add a test case to cover this fix?

I've added some test cases to cover this fix in my latest commit but I've also added a check to avoid disabling the verification for a DSN like this smtps://:@example.com?verify_peer= because it could be misleading to disable it when it clearly doesn't have keywords like no, off or false and is just an empty string.

@nicolas-grekas nicolas-grekas added this to the 5.1 milestone Aug 31, 2020
@fabpot
Copy link
Member
fabpot commented Aug 31, 2020

Thank you @SnakePin.

@fabpot fabpot merged commit 0d99044 into symfony:5.1 Aug 31, 2020
@fabpot fabpot mentioned this pull request Sep 2, 2020
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.

4 participants
0