Skip to content

Commit 56c9ea1

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix failing PDO PgSQL test
2 parents 7426b22 + c0cbf3a commit 56c9ea1

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
@@ -45,7 +45,7 @@ else
4545
# Expected to fail; unless told otherwise, PDO assumes string inputs
4646
# false -> "" as string, which pgsql doesn't like
4747
if (!$res->execute(array(false)))
48-
print_r($res->errorInfo());
48+
print_r(normalizeErrorInfo($res->errorInfo()));
4949
else
5050
print_r($res->fetchAll(PDO::FETCH_ASSOC));
5151

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

0 commit comments

Comments
 (0)