1--TEST-- 2Bug #78152: PDO::exec() - Bad error handling with multiple commands 3--SKIPIF-- 4<?php 5require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); 6require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 7MySQLPDOTest::skip(); 8?> 9--FILE-- 10<?php 11 12require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 13$db = MySQLPDOTest::factory(); 14MySQLPDOTest::createTestTable($db); 15 16var_dump($db->exec("INSERT INTO test(id, label) VALUES (41, 'x'); INSERT INTO test_bad(id, label) VALUES (42, 'y')")); 17$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 18try { 19 var_dump($db->exec("INSERT INTO test(id, label) VALUES (42, 'x'); INSERT INTO test_bad(id, label) VALUES (43, 'y')")); 20} catch (PDOException $e) { 21 echo $e->getMessage(), "\n"; 22} 23 24?> 25--CLEAN-- 26<?php 27require dirname(__FILE__) . '/mysql_pdo_test.inc'; 28MySQLPDOTest::dropTestTable(); 29?> 30--EXPECTF-- 31Warning: PDO::exec(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test_bad' doesn't exist in %s on line %d 32bool(false) 33SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test_bad' doesn't exist 34