xref: /PHP-7.4/ext/pdo/tests/bug_77849.phpt (revision 9ec1525e)
1--TEST--
2PDO Common: Bug #77849 (Unexpected segfault attempting to use cloned 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
16$db = PDOTest::factory();
17$db2 = clone $db;
18?>
19--EXPECTF--
20Fatal error: Uncaught Error: Trying to clone an uncloneable object of class PDO in %s
21Stack trace:
22#0 {main}
23  thrown in %s on line %d
24