#38643 [NEW]: PDO/mysql: wrong results in prepared statement when using parameter twice
| From: | chris dot vigelius at gmx dot net | Date: | Tue, 29 Aug 2006 15:18:47 +0000 |
| Subject: | #38643 [NEW]: PDO/mysql: wrong results in prepared statement when using parameter twice | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-101497@lists.php.net to get a copy of this message | ||
From: chris dot vigelius at gmx dot net
Operating system: Linux
PHP version: 5.1.5
PHP Bug Type: PDO related
Bug description: PDO/mysql: wrong results in prepared statement when using parameter twice
Description:
------------
If a parameter appears more than once in a parametrized query, unexpected
behaviour occurs
Reproduce code:
---------------
$dbh = new PDO(...)
$stmt = $dbh->prepare("SELECT * FROM user WHERE name=:user OR
email=:user");
$stmt->execute(array(':user' => 'franz'));
Expected result:
----------------
only the rows are returned where either name or email are set to 'franz'
Actual result:
--------------
always all rows of the table are returned, which is clearly not what one
would expect
--
Edit bug report at http://bugs.php.net/?id=38643&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38643&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38643&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38643&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38643&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38643&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38643&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38643&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38643&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38643&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38643&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38643&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38643&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38643&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38643&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38643&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38643&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38643&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38643&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38643&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38643&r=mysqlcfg