Skip to content

Commit c0cbf3a

Browse files
committed
Fix failing PDO PgSQL test
This now prints an additional > CONTEXT: unnamed portal parameter $1 = '' on azure, presumably as a result of a version update or configuration change. Strip this additional line from the error info, the same as already done in one other place in the test.
1 parent 89dfe49 commit c0cbf3a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ext/pdo_pgsql/tests/bug_33876.phpt

Lines changed: 10 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,18 @@ 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+
95+
?>
9196
--EXPECTF--
9297
Array
9398
(

0 commit comments

Comments
 (0)