1--TEST-- 2Bug #63185: nextRowset() ignores MySQL errors with native prepared statements 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 13$pdo = MySQLPDOTest::factory(); 14 15$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 16 17$procedure = 'test_procedure_error_at_second_63185'; 18 19$pdo->exec("CREATE PROCEDURE {$procedure} () 20 BEGIN 21 SELECT 'x' AS foo; 22 SELECT * FROM no_such_table; 23 END"); 24 25$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); 26$st = $pdo->query("CALL {$procedure}()"); 27var_dump($st->fetchAll()); 28try { 29 var_dump($st->nextRowset()); 30} catch (PDOException $e) { 31 echo $e->getMessage(), "\n"; 32} 33unset($st); 34 35$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); 36$st = $pdo->query("CALL {$procedure}()"); 37var_dump($st->fetchAll()); 38try { 39 var_dump($st->nextRowset()); 40} catch (PDOException $e) { 41 echo $e->getMessage(), "\n"; 42} 43var_dump($st->fetchAll()); 44?> 45--CLEAN-- 46<?php 47require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 48$pdo = MySQLPDOTest::factory(); 49$pdo->query('DROP PROCEDURE IF EXISTS test_procedure_error_at_second_63185'); 50?> 51--EXPECTF-- 52array(1) { 53 [0]=> 54 array(2) { 55 ["foo"]=> 56 string(1) "x" 57 [0]=> 58 string(1) "x" 59 } 60} 61SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.no_such_table' doesn't exist 62array(1) { 63 [0]=> 64 array(2) { 65 ["foo"]=> 66 string(1) "x" 67 [0]=> 68 string(1) "x" 69 } 70} 71SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.no_such_table' doesn't exist 72array(0) { 73} 74