|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-15 16:46 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
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