-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] Fix parsing Dsn with empty user/password #39531
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
Conversation
Ready to merge from my side 👍 |
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.
Now, I'm wondering why we should do this?
If ppl mess up with their DSN, that's their issue.
And if ppl have the empty string as user/pass, why prevent sending them?
Let me explain it while using an example from Notifier component based on this code: symfony/src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransportFactory.php Lines 27 to 46 in 29d62df
We provide a symfony/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php Lines 47 to 65 in 29d62df
And if it is null we throw an exception, but if it is an empty string this would not bubble up and and empty string in the password could lead to a bad experience. What I want to achieve with this PR is, that the user who implement this bridge can rely on the |
Thank you @OskarStark. |
…Stark) This PR was squashed before being merged into the 5.1 branch. Discussion ---------- [Notifier] Fix parsing Dsn with empty user/password | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | --- Same like #39531, but for Notifier component. I backported the DsnTest from `5.2` to `5.1` Commits ------- a80409a [Notifier] Fix parsing Dsn with empty user/password
While working on a PR for Notifier that user and password would be parsed as an empty string, which is not wrong, but not expected IMO. Thi
scheme://@symfony.com
andscheme://:@symfony.com
should be a valid scheme with user and passnull
Another fix would be to check for
://@
and://:@
and throw anInvalidArgumentException
WDYT?The final solution will then be applied to the Notifier DSN in
5.1