From: tobias382 at gmail dot com Operating system: Windows XP SP2 PHP version: 5.2.4 PHP Bug Type: PDO related Bug description: Bound parameter values cause no results for fetchAll()
Description: ------------ When using any of the various methods of binding parameter values, a query produces no results. When including the parameter value directly in the query string, the query does produce results. Reproduce code: --------------- $db = new PDO('oci://localhost/XE', '------', '-----'); $id = 'Wilson'; $sql = 'SELECT C.* FROM BreadCrumbLinks B, BreadCrumbLinks C WHERE B.Lft BETWEEN C.Lft AND C.Rgt AND B.SiteAreaName = :id ORDER BY C.Lft'; $stmt = $db->prepare($sql); $stmt->bindValue(':id', $id, PDO::PARAM_STR); // Also tried without typecasting and without a colon in the parameter name $stmt->execute(); // also tried with an associative array of parameters and an enumerated array using ? in place of :id in the query print_r($stmt->fetchAll()); $sql = 'SELECT C.* FROM BreadCrumbLinks B, BreadCrumbLinks C WHERE B.Lft BETWEEN C.Lft AND C.Rgt AND B.SiteAreaName = \'' . $id . '\' ORDER BY C.Lft'; $stmt = $db->prepare($sql); $stmt->execute(); print_r($stmt->fetchAll()); Expected result: ---------------- Array ( [0] => Array ( [SITEAREANAME] => Home [0] => Home [SITEAREAURL] => Default.aspx [1] => Default.aspx [LFT] => 1 [2] => 1 [RGT] => 24 [3] => 24 ) ) Array ( [0] => Array ( [SITEAREANAME] => Home [0] => Home [SITEAREAURL] => Default.aspx [1] => Default.aspx [LFT] => 1 [2] => 1 [RGT] => 24 [3] => 24 ) ) Actual result: -------------- Array ( ) Array ( [0] => Array ( [SITEAREANAME] => Home [0] => Home [SITEAREAURL] => Default.aspx [1] => Default.aspx [LFT] => 1 [2] => 1 [RGT] => 24 [3] => 24 ) ) -- Edit bug report at http://bugs.php.net/?id=42598&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42598&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42598&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42598&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42598&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42598&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42598&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42598&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42598&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42598&r=support Expected behavior: http://bugs.php.net/fix.php?id=42598&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42598&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42598&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42598&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42598&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42598&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42598&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42598&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42598&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42598&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42598&r=mysqlcfg