-
Notifications
You must be signed in to change notification settings - Fork 7.9k
pdo_pgsql constructor behavior differs from documentation #12423
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
Labels
Comments
nicolas-grekas
added a commit
to symfony/symfony
that referenced
this issue
Nov 6, 2023
…for PDO PostgreSQL (HypeMC) This PR was merged into the 5.4 branch. Discussion ---------- [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Currently [pdo_pgsql has a bug](php/php-src#12423) where the username & password arguments have precedence over the DSN, even thought [according to the docs](https://www.php.net/manual/en/ref.pdo-pgsql.connection.php) it should be the other way. This was recently fixed on PHP's side, but it [won't be available till 8.4](php/php-src#12424). Since the bug is not present when the values passed are `null`, which are the default argument values anyway, this PR changes the default values of the properties to match. Commits ------- 534c34c [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL
symfony-splitter
pushed a commit
to symfony/cache
that referenced
this issue
Nov 6, 2023
…for PDO PostgreSQL (HypeMC) This PR was merged into the 5.4 branch. Discussion ---------- [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Currently [pdo_pgsql has a bug](php/php-src#12423) where the username & password arguments have precedence over the DSN, even thought [according to the docs](https://www.php.net/manual/en/ref.pdo-pgsql.connection.php) it should be the other way. This was recently fixed on PHP's side, but it [won't be available till 8.4](php/php-src#12424). Since the bug is not present when the values passed are `null`, which are the default argument values anyway, this PR changes the default values of the properties to match. Commits ------- 534c34cb79 [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
Resulted in this output:
But I expected this output instead:
This result means that if both the DSN and the argument are given different credentials, the DSN's credentials are ignored and the argument's credentials are used.
This behavior differs from what is described in the documentation.
https://www.php.net/manual/en/ref.pdo-pgsql.connection.php
Also,
pdo_odbc
can similarly pass credentials to both DSN and arguments, but pdo_odbc gives priority to DSN. Based on these things, I think that the behavior ofpdo_pgsql
should be modified.PHP Version
At least php5.6+
Operating System
any
The text was updated successfully, but these errors were encountered: