xref: /PHP-7.0/ext/pdo_mysql/tests/bug_74376.phpt (revision 27120d44)
1--TEST--
2Bug #74376 (Invalid free of persistent results on error/connection loss)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
7require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
13
14$attr = getenv('PDOTEST_ATTR');
15$attr = $attr ? unserialize($attr) : [];
16$attr[PDO::ATTR_PERSISTENT] = true;
17$attr[PDO::ATTR_EMULATE_PREPARES] = false;
18
19putenv('PDOTEST_ATTR=' . serialize($attr));
20
21$db = MySQLPDOTest::factory();
22$stmt = $db->query("select (select 1 union select 2)");
23
24print "ok";
25?>
26--EXPECTF--
27ok
28