[php-src] Issue #8626: When PDOStatement->execute() failed, then execute successfully, errorInfo() information is incorrect

From: Date: Wed, 25 May 2022 03:16:20 +0000
Subject: [php-src] Issue #8626: When PDOStatement->execute() failed, then execute successfully, errorInfo() information is incorrect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241586@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8626 Author: Yurunsoft ### Description The following code: ```php <?php $pdo = new PDO('mysql:host=127.0.0.1;dbname=db_imi_test', 'root', 'root', [ PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, ]); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); $stmt = $pdo->prepare('insert into tb_test(value) values(?)'); // fail var_dump($stmt->execute([\PHP_INT_MIN]), $stmt->errorCode(), $stmt->errorInfo()); // success var_dump($stmt->execute([1]), $stmt->errorCode(), $stmt->errorInfo()); ``` Resulted in this output: ``` bool(false) string(5) "22003" array(3) { [0]=> string(5) "22003" [1]=> int(1264) [2]=> string(46) "Out of range value for column 'value' at row 1" } bool(true) string(5) "00000" array(3) { [0]=> string(5) "00000" [1]=> int(1264) [2]=> string(46) "Out of range value for column 'value' at row 1" } ``` But I expected this output instead: ``` bool(false) string(5) "22003" array(3) { [0]=> string(5) "22003" [1]=> int(1264) [2]=> string(46) "Out of range value for column 'value' at row 1" } bool(true) string(5) "00000" array(3) { [0]=> string(5) "00000" [1]=> NULL [2]=> NULL } ``` ### PHP Version PHP 7.4、8.0、8.1 ### Operating System Ubuntu 20.04

« previous php.bugs (#241586) next »