Fixed issue #17982: Malformed DSN when using MySQL socket and DB name during installation #2311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How to reproduce
What it happens:
«Database doesn't exist!»
What should happen if the database exists and if the MySQL user can see the database:
Normal installation.
Cause of the problem
It seems that when the user selects a valid socket AND fills the database name,
then DSN is wrongly formatted, without the ';' separator between the socket path
and the database name:
This should be the correct DSN instead (note the
;
before dbname):This problem existed since the feature was originally introduced
here:
The fix consists in assuring that the DSN string ends with the ';' delimiter
also in the case of an user using a socket.
Some users never encountered this problem because they left the database name
blank and put the database name directly into the sock path.
P.S.
The commit includes also a strict string comparison using
===
operator thatis more appropriate when comparing a string with another string.
Fixed issue #17982