xref: /PHP-8.1/ext/pdo/tests/bug_61292.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #61292 (Segfault while calling a method on an overloaded PDO object)
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
17class Database_SQL extends PDO
18{
19    function __construct()
20    {
21                $dsn = getenv('PDOTEST_DSN');
22                $user = getenv('PDOTEST_USER');
23                $pass = getenv('PDOTEST_PASS');
24
25                if ($user === false) $user = NULL;
26                if ($pass === false) $pass = NULL;
27        $options = array(PDO::ATTR_PERSISTENT => TRUE);
28
29        parent::__construct($dsn, $user, $pass, $options);
30    }
31
32    var $bar = array();
33
34    public function foo()
35    {
36        var_dump($this->bar);
37    }
38}
39
40(new Database_SQL)->foo();
41?>
42--EXPECT--
43array(0) {
44}
45