xref: /PHP-8.3/ext/pdo/tests/bug_72788.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #72788 (Invalid memory access when using persistent PDO connection)
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?php
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16
17putenv("PDOTEST_ATTR=" . serialize(array(PDO::ATTR_PERSISTENT => true)));
18
19function test() {
20    $db = PDOTest::factory('PDO', false);
21    $stmt = @$db->query("SELECT 1 FROM TABLE_DOES_NOT_EXIST");
22    if ($stmt === false) {
23        echo "Statement failed as expected\n";
24    }
25}
26
27test();
28test();
29echo "Done";
30?>
31--EXPECT--
32Statement failed as expected
33Statement failed as expected
34Done
35