Skip to content

Commit 4bb7505

Browse files
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>
1 parent 5bfdedd commit 4bb7505

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ext/pdo_pgsql/tests/gh12423.phpt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ PDOTest::skip();
1111
<?php
1212
require __DIR__ . '/config.inc';
1313

14-
[
15-
'ENV' => [
16-
'PDOTEST_DSN' => $dsnWithCredentials,
17-
'PDOTEST_USER' => $user,
18-
'PDOTEST_PASS' => $password,
19-
],
20-
] = __DIR__ . '/common.phpt';
21-
14+
$dsnWithCredentials = $config['ENV']['PDOTEST_DSN'];
15+
$user = $config['ENV']['PDOTEST_USER'] ?? null;
16+
$password = $config['ENV']['PDOTEST_PASS'] ?? null;
17+
if (!$user) {
18+
preg_match('/user=(.*?) /', $dsnWithCredentials, $match);
19+
$user = $match[1] ?? '';
20+
}
21+
if (!$password) {
22+
preg_match('/password=(.*?) /', $dsnWithCredentials, $match);
23+
$password = $match[1] ?? '';
24+
}
2225
$dsn = str_replace(" user={$user} password={$password}", '', $dsnWithCredentials);
2326

2427
echo "dsn without credentials / correct user / correct password\n";

0 commit comments

Comments
 (0)