xref: /PHP-8.3/ext/pdo_mysql/tests/bug_74376.phpt (revision b5a14e6c)
1--TEST--
2Bug #74376 (Invalid free of persistent results on error/connection loss)
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$attr = getenv('PDOTEST_ATTR');
16$attr = $attr ? unserialize($attr) : [];
17$attr[PDO::ATTR_PERSISTENT] = true;
18$attr[PDO::ATTR_EMULATE_PREPARES] = false;
19
20putenv('PDOTEST_ATTR=' . serialize($attr));
21
22$db = MySQLPDOTest::factory();
23$stmt = $db->query("select (select 1 union select 2)");
24
25print "ok";
26?>
27--EXPECTF--
28
29Warning: PDO::query(): SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row in %s on line %d
30ok
31