[php-src] Issue #21176: php 8.1.34 - Unit test failure

From: Date: Mon, 09 Feb 2026 03:23:17 +0000
Subject: [php-src] Issue #21176: php 8.1.34 - Unit test failure
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251672@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21176 Author: tharukaDacquia ### Description The following code: https://github.com/php/php-src/blob/PHP-8.5.3/ext/pdo_pgsql/tests/ghsa-8xr5-qppj-gvwj.phpt ```php --TEST-- #GHSA-8xr5-qppj-gvwj: NULL Pointer Derefernce for failed user input quoting --EXTENSIONS-- pdo pdo_pgsql --SKIPIF-- <?php require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; require_once dirname(__FILE__) . '/config.inc'; PDOTest::skip(); ?> --FILE-- <?php require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; require_once dirname(__FILE__) . '/config.inc'; $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $sql = "SELECT * FROM users where username = :username"; $stmt = $db->prepare($sql); $p1 = "alice\x99"; var_dump($stmt->execute(['username' => $p1])); ?> --EXPECT-- bool(false) ``` Resulted in this output: ``` ========DIFF======== 001+ Fatal error: Uncaught PDOException: SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0x99 in /home/webuser/ext/pdo_pgsql/tests/ghsa-8xr5-qppj-gvwj.php:12 001- bool(false) 002+ Stack trace: 003+ #0 /home/webuser/ext/pdo_pgsql/tests/ghsa-8xr5-qppj-gvwj.php(12): PDOStatement->execute(Array) 004+ #1 {main} 005+ thrown in /home/webuser/ext/pdo_pgsql/tests/ghsa-8xr5-qppj-gvwj.php on line 12 ========DONE======== FAIL #GHSA-8xr5-qppj-gvwj: NULL Pointer Derefernce for failed user input quoting [ext/pdo_pgsql/tests/ghsa-8xr5-qppj-gvwj.phpt] ``` But I expected this output instead: ``` Based on the unit test code as i think we can't expect false as expectation since we enabling $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) ``` ### PHP Version ```plain php 8.1.34 ``` ### Operating System Ubuntu 18.04

« previous php.bugs (#251672) next »