ID: 39146 Updated by: [EMAIL PROTECTED] Reported By: php at mailingslists dot birkholz dot biz -Status: Open +Status: Closed Bug Type: PDO related Operating System: Linux 2.6.17-gentoo-r7 PHP Version: 5.1.6 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2006-10-13 12:29:18] php at mailingslists dot birkholz dot biz Description: ------------ When binding to a named placeholder in a prepared-statement using mysql-5.0.24-r1 causes unpredictable behaviour. With PHP 5.1.4 the query goes correct. Reproduce code: --------------- <?php $dbh = new PDO('mysql:host=localhost;dbname=mysql', 'root', 'pwd'); $query1 = "SELECT * FROM user WHERE User=:user AND Host IN (SELECT Host FROM user WHERE User=:user)"; $query2 = "SELECT * FROM user WHERE Host IN (SELECT Host FROM user WHERE User=:user) AND User=:user"; $stm1 = $dbh->prepare($query1); $stm1->bindValue(':user', 'root'); $stm1->execute(); print count($stm1->fetchAll()).'<br>'; $stm2 = $dbh->prepare($query2); $stm2->bindValue(':user', 'root'); $stm2->execute(); print count($stm2->fetchAll()).'<br>'; Expected result: ---------------- Should return: (like it does using the command-line-client) 2 2 Actual result: -------------- It returns: 2 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39146&edit=1