xref: /php-src/ext/pdo_mysql/tests/bug_74376.phpt (revision 4bb75d56)
1--TEST--
2Bug #74376 (Invalid free of persistent results on error/connection loss)
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;
15$attr = $attr ? unserialize($attr) : [];
16$attr[PDO::ATTR_PERSISTENT] = true;
17$attr[PDO::ATTR_EMULATE_PREPARES] = false;
18
19$db = MySQLPDOTest::factoryWithAttr($attr);
20$stmt = $db->query("SELECT (SELECT 1 UNION SELECT 2)");
21
22print "ok";
23?>
24--EXPECTF--
25
26Warning: PDO::query(): SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row in %s on line %d
27ok
28