1--TEST-- 2Change column count after statement has been prepared 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 15$db = MySQLPDOTest::factory(); 16$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 17$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); 18 19$db->exec('DROP TABLE IF EXISTS test'); 20$db->exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name VARCHAR(255) NOT NULL)'); 21 22$stmt = $db->prepare('INSERT INTO test (id, name) VALUES(:id, :name)'); 23$stmt->execute([ 24 'id' => 10, 25 'name' => 'test', 26]); 27 28$stmt = $db->prepare('SELECT * FROM test WHERE id = :id'); 29$stmt->execute(['id' => 10]); 30var_dump($stmt->fetchAll(\PDO::FETCH_ASSOC)); 31 32$db->exec('ALTER TABLE test ADD new_col VARCHAR(255)'); 33$stmt->execute(['id' => 10]); 34var_dump($stmt->fetchAll(\PDO::FETCH_ASSOC)); 35 36?> 37--CLEAN-- 38<?php 39require __DIR__ . '/mysql_pdo_test.inc'; 40MySQLPDOTest::dropTestTable(); 41?> 42--EXPECT-- 43array(1) { 44 [0]=> 45 array(2) { 46 ["id"]=> 47 string(2) "10" 48 ["name"]=> 49 string(4) "test" 50 } 51} 52array(1) { 53 [0]=> 54 array(3) { 55 ["id"]=> 56 string(2) "10" 57 ["name"]=> 58 string(4) "test" 59 ["new_col"]=> 60 NULL 61 } 62} 63