Bug #61327 [Fbk->NoF]: PDO complain about Invalid parameter number

From: Date: Sun, 21 Aug 2016 04:22:22 +0000
Subject: Bug #61327 [Fbk->NoF]: PDO complain about Invalid parameter number
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203430@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61327&edit=1 ID: 61327 Updated by: php-bugs@lists.php.net Reported by: daniel dot caillibaud at sesamath dot net Summary: PDO complain about Invalid parameter number -Status: Feedback +Status: No Feedback Type: Bug Package: PDO Core Operating System: linux PHP Version: 5.3.10 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2016-08-08 17:43:13] cmb@php.net This doesn't appear to be a general PDO problem; at least I can't reproduce it with pdo_sqlite, see <https://3v4l.org/64MQv>. So if this problem persists with current PHP versions, we need more specific information to be able to address the issue. ------------------------------------------------------------------------ [2012-03-08 15:27:25] daniel dot caillibaud at sesamath dot net Description: ------------ The query INSERT INTO $table VALUES (\"first value\"); -- dam'd quote INSERT INTO $table VALUES (\"foo : ba'r \"), (\"foo.:bar\"); Throws Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound But doesn't - without first query before comment - without comment - with escaped quote - with space after last colon Test script: --------------- // This query doesn't work $q1 = "INSERT INTO $table VALUES (\"first value\"); -- dam'd quote INSERT INTO $table VALUES (\"foo : ba'r \"), (\"foo.:bar\"); "; // But all these doesn't have any pb $q2 = "-- dam'd quote INSERT INTO $table VALUES (\"foo : ba'r \"), (\"foo.:bar\"); "; // without first one (before comment) $q3 = "INSERT INTO $table VALUES (\"first value\"); INSERT INTO $table VALUES (\"foo : ba'r \"), (\"foo.:bar\"); "; // without comment $q4 = "INSERT INTO $table VALUES (\"first value\"); -- dam'd quote INSERT INTO $table VALUES (\"foo : ba\'r \"), (\"foo.:bar\"); "; // with escaped quote $q5 = "INSERT INTO $table VALUES (\"first value\"); -- dam'd quote INSERT INTO $table VALUES (\"foo : ba'r \"), (\"foo.: bar\"); "; // with space after last colon try { $pdo = new PDO($dsn, $user, $pass, $options); $stmt = $pdo->prepare($query); $stmt->execute(); } catch (Exception $e) { echo "Failed : " .$e->getMessage(); } Expected result: ---------------- No warning Actual result: -------------- Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61327&edit=1

« previous php.bugs (#203430) next »