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