1
0
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:
David CARLIER
2023-10-16 08:04:55 +01:00
committed by GitHub
parent 5bfdedd15d
commit 4bb75058a3

View File

@@ -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";