Skip to content

Commit

Permalink
Merge branch 'PHP-7.4' into PHP-8.0
Browse files Browse the repository at this point in the history
* PHP-7.4:
  Fix failing PDO PgSQL test
  • Loading branch information
nikic committed Oct 7, 2021
2 parents 7426b22 + c0cbf3a commit 56c9ea1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ext/pdo_pgsql/tests/bug_33876.phpt
Expand Up @@ -45,7 +45,7 @@ else
# Expected to fail; unless told otherwise, PDO assumes string inputs
# false -> "" as string, which pgsql doesn't like
if (!$res->execute(array(false)))
print_r($res->errorInfo());
print_r(normalizeErrorInfo($res->errorInfo()));
else
print_r($res->fetchAll(PDO::FETCH_ASSOC));

Expand Down Expand Up @@ -81,13 +81,17 @@ else
# Expected to fail; unless told otherwise, PDO assumes string inputs
# false -> "" as string, which pgsql doesn't like
if (!$res->execute(array(false))) {
$err = $res->errorInfo();
// Strip additional lines outputted by recent PgSQL versions
$err[2] = trim(current(explode("\n", $err[2])));
print_r($err);
print_r(normalizeErrorInfo($res->errorInfo()));
} else {
print_r($res->fetchAll(PDO::FETCH_ASSOC));
}

function normalizeErrorInfo(array $err): array {
// Strip additional lines outputted by recent PgSQL versions
$err[2] = trim(current(explode("\n", $err[2])));
return $err;
}

?>
--EXPECTF--
Array
Expand Down

0 comments on commit 56c9ea1

Please sign in to comment.