xref: /PHP-7.3/ext/pdo/tests/bug_61292.phpt (revision ded3d984)
1--TEST--
2PDO Common: Bug #61292 (Segfault while calling a method on an overloaded PDO object)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo')) die('skip');
6$dir = getenv('REDIR_TEST_DIR');
7if (false == $dir) die('skip no driver');
8require_once $dir . 'pdo_test.inc';
9PDOTest::skip();
10?>
11--FILE--
12<?php
13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
14require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
15
16class Database_SQL extends PDO
17{
18	function __construct()
19	{
20                $dsn = getenv('PDOTEST_DSN');
21                $user = getenv('PDOTEST_USER');
22                $pass = getenv('PDOTEST_PASS');
23
24                if ($user === false) $user = NULL;
25                if ($pass === false) $pass = NULL;
26		$options = array(PDO::ATTR_PERSISTENT => TRUE);
27
28		parent::__construct($dsn, $user, $pass, $options);
29	}
30
31	var $bar = array();
32
33	public function foo()
34	{
35		var_dump($this->bar);
36	}
37}
38
39(new Database_SQL)->foo();
40?>
41--EXPECT--
42array(0) {
43}
44