Skip to content

[HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl #40300

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
Mar 23, 2021

Conversation

bcremer
Copy link
Contributor

@bcremer bcremer commented Feb 25, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #40290
License MIT
Doc PR symfony/symfony-docs#...

@bcremer
Copy link
Contributor Author

bcremer commented Feb 25, 2021

Travis CI fail seems to be unrelated.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you.

Just a small thing and I'll be happy to merge.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

(after @Nyholm's comment has been addressed)

@bcremer
Copy link
Contributor Author

bcremer commented Feb 25, 2021

Added a commit but I'm not sure if the added complexity is worth it.

The documentation states:

The MySQL Unix socket (shouldn't be used with host or port).

Still it works fine when port and host are given. So I would argue it's up the the user not specify a host that's not localhost when using the unix_socket param.

@bcremer bcremer force-pushed the feature-unix_socket branch from 9f2866f to 7958f6b Compare February 25, 2021 15:53
@nicolas-grekas nicolas-grekas added this to the 5.x milestone Feb 25, 2021
@carsonbot carsonbot changed the title Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl [HttpFoundation] Add support for mysql unix_socket and charset in PdoSessionHandler::buildDsnFromUrl Feb 25, 2021
@derrabus derrabus requested a review from Nyholm March 18, 2021 15:05
@Nyholm Nyholm force-pushed the feature-unix_socket branch from cbbc143 to bdc03bc Compare March 18, 2021 15:22
@Nyholm
Copy link
Member

Nyholm commented Mar 18, 2021

I moved around the logic in a way so it became more clear and (hopefully) less complex. Basically: "If you are doing unix_socket, do the complex code. If not, just continue as normally".

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

@bcremer I would be happy to see what you think.

@bcremer
Copy link
Contributor Author

bcremer commented Mar 18, 2021

@Nyholm Looks like an reasonable improvement for me.

Maybe add the following testcase to be sure the charset option works also when unix_socket is not given:

yield ['mysql://localhost/test?charset=utf8mb4', 'mysql:charset=utf8mb4;dbname=test'];

@Nyholm
Copy link
Member

Nyholm commented Mar 18, 2021

Great idea.
Yes, please do

@bcremer bcremer force-pushed the feature-unix_socket branch from 2488b3c to 474bda3 Compare March 19, 2021 05:58
@nicolas-grekas
Copy link
Member

Thank you @bcremer.

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.

PdoSessionHandler::buildDsnFromUrl not compatible with Doctrine Connection URL
5 participants