Skip to content

Commit de8c5fc

Browse files
bug symfony#52457 [Cache][HttpFoundation][Lock] Fix empty username/password 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
2 parents 5c949c1 + 534c34c commit de8c5fc

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/Symfony/Component/Cache/Adapter/PdoAdapter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
3434
private $dataCol = 'item_data';
3535
private $lifetimeCol = 'item_lifetime';
3636
private $timeCol = 'item_time';
37-
private $username = '';
38-
private $password = '';
37+
private $username = null;
38+
private $password = null;
3939
private $connectionOptions = [];
4040
private $namespace;
4141

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ class PdoSessionHandler extends AbstractSessionHandler
112112
/**
113113
* Username when lazy-connect.
114114
*
115-
* @var string
115+
* @var string|null
116116
*/
117-
private $username = '';
117+
private $username = null;
118118

119119
/**
120120
* Password when lazy-connect.
121121
*
122-
* @var string
122+
* @var string|null
123123
*/
124-
private $password = '';
124+
private $password = null;
125125

126126
/**
127127
* Connection options when lazy-connect.

src/Symfony/Component/Lock/Store/PdoStore.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* Lock metadata are stored in a table. You can use createTable() to initialize
2626
* a correctly defined table.
27-
27+
*
2828
* CAUTION: This store relies on all client and server nodes to have
2929
* synchronized clocks for lock expiry to occur at the correct time.
3030
* To ensure locks don't expire prematurely; the TTLs should be set with enough
@@ -40,8 +40,8 @@ class PdoStore implements PersistingStoreInterface
4040
private $conn;
4141
private $dsn;
4242
private $driver;
43-
private $username = '';
44-
private $password = '';
43+
private $username = null;
44+
private $password = null;
4545
private $connectionOptions = [];
4646

4747
private $dbalStore;

src/Symfony/Component/Lock/Store/PostgreSqlStore.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class PostgreSqlStore implements BlockingSharedLockStoreInterface, BlockingStore
2929
{
3030
private $conn;
3131
private $dsn;
32-
private $username = '';
33-
private $password = '';
32+
private $username = null;
33+
private $password = null;
3434
private $connectionOptions = [];
3535
private static $storeRegistry = [];
3636

0 commit comments

Comments
 (0)