From:             
Operating system: windows 7
PHP version:      5.3.8
Package:          PDO related
Bug Type:         Bug
Bug description:Many multi-row statements gives wrong result

Description:
------------
If you create two query of multi-row statements in one .php file and you
assign 
them 
to the same variable after processing one of them, the second query will
give only 
result of only ONE statement.

If you assign the result of query to another variable, the result will be
correct.

So    $another_var_name = $conn->query("SELECT 1 as one; SELECT 2 as two;
SELECT 3 
as three;");

will work in Test script, otherwise result will be wrong.

Test script:
---------------
               $q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT
3 as three;");
           
                do
                {
                   $r=$q->fetchAll(PDO::FETCH_ASSOC);
                   echo "<br />";
                   print_r($r);       
                   
                }while($q->nextRowset());
                
           
               $q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT
3 as three;");
           
                do
                {
                   $r=$q->fetchAll(PDO::FETCH_ASSOC);
                     echo "<br />";
                   print_r($r);       
                   
                }while($q->nextRowset());   

Expected result:
----------------
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) )
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) ) 

Actual result:
--------------
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) )
Array ( [0] => Array ( [one] => 1 ) ) 

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60122&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60122&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60122&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60122&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60122&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60122&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60122&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60122&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60122&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60122&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60122&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60122&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60122&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60122&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60122&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60122&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60122&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60122&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60122&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60122&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60122&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60122&r=mysqlcfg

Reply via email to