From: news at franky dot net Operating system: Mac OS X 10.8.5 PHP version: 5.4.21 Package: PDO related Bug Type: Bug Bug description:Nested use of pdo->prepare()->execute clears the outer resultset-object
Description: ------------ In PHP 5.3 the test script works fine and gives me the results as you see in "expected result". If i use PHP 5.4 or PHP 5.5, the inner pdo->prepare()->execute clears the outer PDO-Resultset unexpectedly. Test script: --------------- $pdo = new PDO("dblib:host=192.168.1.100;dbname=kunden;charset=UTF-8;", "kunden", "geheim"); $stmt = $pdo->prepare("select top 10 * from Kunden"); $stmt->execute(); while($row = $stmt->fetch()) { echo 'KundenID: ' . $row["KundenID"] . '<br />'; $stmt2 = $pdo->prepare("select top 10 * from Ansprechpartner where KundenID=?"); $stmt2->execute(array($row["KundenID"])); while($row2 = $stmt2->fetch()) { echo 'AnsprechpartnerID: ' . $row2["AnsprechpartnerID"] . '<br />'; } } unset($pdo); Expected result: ---------------- KundenID: 10 AnsprechpartnerID: 1624 AnsprechpartnerID: 1716 AnsprechpartnerID: 7823 AnsprechpartnerID: 9309 AnsprechpartnerID: 10398 AnsprechpartnerID: 18686 KundenID: 13 AnsprechpartnerID: 1621 KundenID: 15 AnsprechpartnerID: 1596 AnsprechpartnerID: 4769 AnsprechpartnerID: 92891 Actual result: -------------- KundenID: 10 AnsprechpartnerID: 1624 AnsprechpartnerID: 1716 AnsprechpartnerID: 7823 AnsprechpartnerID: 9309 AnsprechpartnerID: 10398 AnsprechpartnerID: 18686 -- Edit bug report at https://bugs.php.net/bug.php?id=65945&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65945&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65945&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65945&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65945&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65945&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65945&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65945&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65945&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65945&r=support Expected behavior: https://bugs.php.net/fix.php?id=65945&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65945&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65945&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65945&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65945&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65945&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65945&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65945&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65945&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65945&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65945&r=mysqlcfg