1--TEST-- 2Bug GH-11550 (MySQL Statement has a empty query result when the response field has changed, also Segmentation fault) 3--EXTENSIONS-- 4pdo 5pdo_mysql 6--SKIPIF-- 7<?php 8require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'; 9MySQLPDOTest::skip(); 10?> 11--FILE-- 12<?php 13require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'; 14$pdo = MySQLPDOTest::factory(); 15 16$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); 17 18$pdo->exec(<<<'SQL' 19CREATE TABLE `test_gh11550` ( 20 `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 21 `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, 22 PRIMARY KEY (`id`) USING BTREE, 23 INDEX `name`(`name`) USING BTREE 24) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; 25SQL); 26$pdo->exec(<<<'SQL' 27INSERT INTO `test_gh11550` (`name`) VALUES ('test1'); 28SQL); 29 30$stmt = $pdo->prepare('select * from test_gh11550'); 31var_dump('PDO-1:', $stmt->execute(), $stmt->fetchAll()); 32 33$stmt->closeCursor(); // Optional. Segmentation fault (core dumped) 34 35$pdo->exec(<<<'SQL' 36ALTER TABLE `test_gh11550` 37ADD COLUMN `a` varchar(255) NOT NULL DEFAULT ''; 38SQL); 39 40var_dump('PDO-2:', $stmt->execute(), $stmt->fetchAll()); 41echo 'Done'; 42?> 43--CLEAN-- 44<?php 45require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'; 46$pdo = MySQLPDOTest::factory(); 47$pdo->query('DROP TABLE IF EXISTS test_gh11550'); 48?> 49--EXPECT-- 50string(6) "PDO-1:" 51bool(true) 52array(1) { 53 [0]=> 54 array(4) { 55 ["id"]=> 56 string(1) "1" 57 [0]=> 58 string(1) "1" 59 ["name"]=> 60 string(5) "test1" 61 [1]=> 62 string(5) "test1" 63 } 64} 65string(6) "PDO-2:" 66bool(true) 67array(1) { 68 [0]=> 69 array(6) { 70 ["id"]=> 71 string(1) "1" 72 [0]=> 73 string(1) "1" 74 ["name"]=> 75 string(5) "test1" 76 [1]=> 77 string(5) "test1" 78 ["a"]=> 79 string(0) "" 80 [2]=> 81 string(0) "" 82 } 83} 84Done 85