1--TEST-- 2PDO MySQL Bug #41997 (stored procedure call returning single rowset blocks future queries) 3--XFAIL-- 4nextRowset() problem with stored proc & emulation mode & mysqlnd 5--SKIPIF-- 6<?php 7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc'); 8require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 9MySQLPDOTest::skip(); 10 11$db = MySQLPDOTest::factory(); 12$row = $db->query('SELECT VERSION() as _version')->fetch(PDO::FETCH_ASSOC); 13$matches = array(); 14if (!preg_match('/^(\d+)\.(\d+)\.(\d+)/ismU', $row['_version'], $matches)) 15 die(sprintf("skip Cannot determine MySQL Server version\n")); 16 17$version = $matches[1] * 10000 + $matches[2] * 100 + $matches[3]; 18if ($version < 50000) 19 die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n", 20 $matches[1], $matches[2], $matches[3], $version)); 21?> 22--FILE-- 23<?php 24require __DIR__ . '/mysql_pdo_test.inc'; 25$db = MySQLPDOTest::factory(); 26 27$db->exec('DROP PROCEDURE IF EXISTS p'); 28$db->exec('CREATE PROCEDURE p() BEGIN SELECT 1 AS "one"; END'); 29 30$stmt = $db->query("CALL p()"); 31do { 32 var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); 33} while ($stmt->nextRowset()); 34var_dump($stmt->errorInfo()); 35 36$stmt = $db->query('SELECT 2 AS "two"'); 37var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); 38var_dump($stmt->errorInfo()); 39print "done!"; 40?> 41--EXPECT-- 42array(1) { 43 [0]=> 44 array(1) { 45 ["one"]=> 46 string(1) "1" 47 } 48} 49array(3) { 50 [0]=> 51 string(5) "00000" 52 [1]=> 53 NULL 54 [2]=> 55 NULL 56} 57array(1) { 58 [0]=> 59 array(1) { 60 ["two"]=> 61 string(1) "2" 62 } 63} 64array(3) { 65 [0]=> 66 string(5) "00000" 67 [1]=> 68 NULL 69 [2]=> 70 NULL 71} 72done! 73