|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-05-05 21:36 UTC] thomas dot wleight at googlemail dot com
[2020-05-06 08:31 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2020-05-06 08:31 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 12 21:00:01 2025 UTC |
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