Skip to content

Commit 90ceac6

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix failing PDO PgSQL test
2 parents 544aebb + 56c9ea1 commit 90ceac6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ext/pdo_pgsql/tests/bug_33876.phpt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747
# Expected to fail; unless told otherwise, PDO assumes string inputs
4848
# false -> "" as string, which pgsql doesn't like
4949
if (!$res->execute(array(false)))
50-
print_r($res->errorInfo());
50+
print_r(normalizeErrorInfo($res->errorInfo()));
5151
else
5252
print_r($res->fetchAll(PDO::FETCH_ASSOC));
5353

@@ -83,13 +83,17 @@ else
8383
# Expected to fail; unless told otherwise, PDO assumes string inputs
8484
# false -> "" as string, which pgsql doesn't like
8585
if (!$res->execute(array(false))) {
86-
$err = $res->errorInfo();
87-
// Strip additional lines outputted by recent PgSQL versions
88-
$err[2] = trim(current(explode("\n", $err[2])));
89-
print_r($err);
86+
print_r(normalizeErrorInfo($res->errorInfo()));
9087
} else {
9188
print_r($res->fetchAll(PDO::FETCH_ASSOC));
9289
}
90+
91+
function normalizeErrorInfo(array $err): array {
92+
// Strip additional lines outputted by recent PgSQL versions
93+
$err[2] = trim(current(explode("\n", $err[2])));
94+
return $err;
95+
}
96+
9397
?>
9498
--EXPECTF--
9599
Array

0 commit comments

Comments
 (0)