Bug #79568 [NEW]: No exception when more PDO parameters passed than needed

From: Date: Tue, 05 May 2020 21:33:26 +0000
Subject: Bug #79568 [NEW]: No exception when more PDO parameters passed than needed
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226931@lists.php.net to get a copy of this message
From: thomas dot wleight at googlemail dot com Operating system: Debian 9 PHP version: 7.3.17 Package: PDO MySQL Bug Type: Bug Bug description:No exception when more PDO parameters passed than needed Description: ------------ If array "$pdo_parameters" contains only 1 element then everything works as expected and I receive a result. However when "$pdo_parameters" contains more than one I don't receive any results at all without any exception message. PHP errors are active, but I don't see any PDO error message. Passing more PDO parameters than needed should result in a PDO error. Test script: --------------- // db credentials $dbhost = "localhost"; $dbuser = "user"; $dbpass = "password"; $dbname = "database"; // pdo $dsn = "mysql:host=".$dbhost.";dbname=".$dbname.";charset=utf8"; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false ]; $pdo = new PDO($dsn, $dbuser, $dbpass, $options); $sql = "SELECT * FROM foo WHERE bar > ?"; $pdo_parameters = [ 1, 2, 3 ]; $stmt = $pdo->prepare( $sql ); // PDO exception should be thrown here $stmt->execute( [ 1, 2, 3 ] ); Expected result: ---------------- Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number in /tmp/test:18 Stack trace: #0 /tmp/test.php(18): PDOStatement->execute(Array) #1 {main} thrown in /tmp/test.php on line 18 Actual result: -------------- no error -- Edit bug report at https://bugs.php.net/bug.php?id=79568&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79568&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79568&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79568&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79568&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79568&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79568&r=support Expected behavior: https://bugs.php.net/fix.php?id=79568&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79568&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79568&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79568&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79568&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79568&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79568&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79568&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79568&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79568&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79568&r=mysqlcfg

« previous php.bugs (#226931) next »