xref: /PHP-8.0/ext/spl/tests/bug79987.phpt (revision 61b33e90)
1--TEST--
2Bug #79987 (Memory leak in SplFileInfo because of missing zend_restore_error_handling())
3--FILE--
4<?php
5class BadSplFileInfo extends SplFileInfo {
6    public function __construct() {
7    }
8}
9$x = new BadSplFileInfo();
10set_error_handler(function ($type, $msg, $file, $line, $context = []) {
11    echo "ops\n";
12});
13try {
14    var_dump($x->getLinkTarget());
15} catch (Throwable $e) {
16    echo $e->getMessage() . "\n";
17}
18try {
19    var_dump($x->getFilename());
20} catch (Throwable $e) {
21    echo $e->getMessage() . "\n";
22}
23try {
24    var_dump($x->getExtension());
25} catch (Throwable $e) {
26    echo $e->getMessage() . "\n";
27}
28try {
29    var_dump($x->getBasename());
30} catch (Throwable $e) {
31    echo $e->getMessage() . "\n";
32}
33?>
34--EXPECT--
35Object not initialized
36Object not initialized
37Object not initialized
38Object not initialized
39