1--TEST-- 2Bug #41125 (PDO mysql + quote() + prepare() can result in segfault) 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$db = MySQLPDOTest::factory(); 14$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); 15 16// And now allow the evil to do his work 17$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1); 18$sql = <<<SQL 19 CREATE TABLE IF NOT EXISTS test_41125 (id INT); 20 INSERT INTO test_41125 (id) VALUES (1); 21 SELECT * FROM test_41125; 22 INSERT INTO test_41125 (id) VALUES (2); 23 SELECT * FROM test_41125; 24SQL; 25$stmt = $db->query($sql); 26do { 27 var_dump($stmt->fetchAll()); 28} while ($stmt->nextRowset()); 29 30print "done!"; 31?> 32--CLEAN-- 33<?php 34require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 35$db = MySQLPDOTest::factory(); 36$db->exec("DROP TABLE IF EXISTS test_41125"); 37?> 38--EXPECT-- 39array(0) { 40} 41array(0) { 42} 43array(1) { 44 [0]=> 45 array(2) { 46 ["id"]=> 47 string(1) "1" 48 [0]=> 49 string(1) "1" 50 } 51} 52array(0) { 53} 54array(2) { 55 [0]=> 56 array(2) { 57 ["id"]=> 58 string(1) "1" 59 [0]=> 60 string(1) "1" 61 } 62 [1]=> 63 array(2) { 64 ["id"]=> 65 string(1) "2" 66 [0]=> 67 string(1) "2" 68 } 69} 70done! 71