#39146 [Opn->Csd]: Named placeholder is not bound correctly with Subqueries
| From: | iliaa@php.net | Date: | Sun, 15 Oct 2006 16:46:39 +0000 |
| Subject: | #39146 [Opn->Csd]: Named placeholder is not bound correctly with Subqueries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103566@lists.php.net to get a copy of this message | ||
ID: 39146
Updated by: iliaa@php.net
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