mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix 12424 PDO_PGSQL unit test unexistent variables (#12446)
* Fix 12424 PDO_PGSQL unit test unexistent variables Co-authored-by: Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>
This commit is contained in:
@@ -11,14 +11,17 @@ PDOTest::skip();
|
||||
<?php
|
||||
require __DIR__ . '/config.inc';
|
||||
|
||||
[
|
||||
'ENV' => [
|
||||
'PDOTEST_DSN' => $dsnWithCredentials,
|
||||
'PDOTEST_USER' => $user,
|
||||
'PDOTEST_PASS' => $password,
|
||||
],
|
||||
] = __DIR__ . '/common.phpt';
|
||||
|
||||
$dsnWithCredentials = $config['ENV']['PDOTEST_DSN'];
|
||||
$user = $config['ENV']['PDOTEST_USER'] ?? null;
|
||||
$password = $config['ENV']['PDOTEST_PASS'] ?? null;
|
||||
if (!$user) {
|
||||
preg_match('/user=(.*?) /', $dsnWithCredentials, $match);
|
||||
$user = $match[1] ?? '';
|
||||
}
|
||||
if (!$password) {
|
||||
preg_match('/password=(.*?) /', $dsnWithCredentials, $match);
|
||||
$password = $match[1] ?? '';
|
||||
}
|
||||
$dsn = str_replace(" user={$user} password={$password}", '', $dsnWithCredentials);
|
||||
|
||||
echo "dsn without credentials / correct user / correct password\n";
|
||||
|
||||
Reference in New Issue
Block a user