xref: /PHP-8.4/ext/pdo_mysql/tests/bug_61411.phpt (revision 4bb75d56)
1--TEST--
2Bug #61411 (PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES == FALSE)
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
14$attr = PDO_MYSQL_TEST_ATTR;
15if (!$attr) {
16    $attr = array();
17} else {
18    $attr = unserialize($attr);
19}
20$attr[PDO::ATTR_PERSISTENT] = true;
21$attr[PDO::ATTR_EMULATE_PREPARES] = false;
22$attr[PDO::ATTR_STRINGIFY_FETCHES] = true;
23
24$db = MySQLPDOTest::factoryWithAttr($attr);
25
26$stmt = $db->prepare("SELECT 1");
27$stmt->execute();
28
29foreach ($stmt as $line) {
30    var_dump($line);
31}
32
33print "done!";
34?>
35--EXPECT--
36array(2) {
37  [1]=>
38  string(1) "1"
39  [0]=>
40  string(1) "1"
41}
42done!
43