Bug #80355 [NEW]: Prepared statement broke with \ and -- characters

From: Date: Thu, 12 Nov 2020 16:17:04 +0000
Subject: Bug #80355 [NEW]: Prepared statement broke with \ and -- characters
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230306@lists.php.net to get a copy of this message
From: sartorua at gmail dot com Operating system: Ubuntu 20.04 PHP version: 7.4.12 Package: PDO related Bug Type: Bug Bug description:Prepared statement broke with \ and -- characters Description: ------------ SQL statement parser don't work with prepared parameters if SQL query string contains \ and -- characters (order matters). PHP produces error: Exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: :e' Test script: --------------- $pdo = new \PDO('pgsql:host=localhost;dbname=postgres', 'postgres', 'postgres'); $s = $pdo->prepare("SELECT v FROM (VALUES ('\'),('--')) AS u (v) WHERE u.v = :e"); $s->execute([':e' => 'foo']); $s->fetchAll(); -- Edit bug report at https://bugs.php.net/bug.php?id=80355&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80355&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80355&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80355&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80355&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80355&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80355&r=support Expected behavior: https://bugs.php.net/fix.php?id=80355&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80355&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80355&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80355&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80355&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80355&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80355&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80355&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80355&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80355&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80355&r=mysqlcfg

« previous php.bugs (#230306) next »