ID: 42113 Updated by: [EMAIL PROTECTED] Reported By: dominique dot archambault at gmail dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Debian lenny PHP Version: 5.2.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi Previous Comments: ------------------------------------------------------------------------ [2007-07-26 16:03:44] dominique dot archambault at gmail dot com Description: ------------ Using PHP 5.2.3 and MySQL 5.0.38. If there are placeholders in string constants of an SQL query, and there are also escaped quotes in a string constant (either the same string constant, or a different one), the following error is triggered: Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in <FILE> on line <LINE> Reproduce code: --------------- // WORKS $stmt = $pdo->prepare("SELECT * FROM `test` WHERE `test`.`text` = \"Hello world's! 2007-01-01 00:00:00\""); if ($stmt->execute()) { print "PASSED!\n"; } else { // should not enter this print "FAILED!\n"; var_dump($stmt->errorInfo()); } // DOES NOT WORK $stmt = $pdo->prepare("SELECT * FROM `test` WHERE `test`.`text` = 'Hello world\'s! 2007-01-01 00:00:00'"); // the following execute() call will generate the error if ($stmt->execute()) { print "PASSED!\n"; } else { // will always enter this print "FAILED!\n"; var_dump($stmt->errorInfo()); // will contain: array(1) { [0]=> string(5) "HY093" } } Expected result: ---------------- PASSED! PASSED! Actual result: -------------- PASSED! Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in <FILE> on line <LINE> FAILED! array(1) { [0]=> string(5) "HY093" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42113&edit=1
