xref: /PHP-8.2/ext/spl/tests/gh16604_2.phpt (revision 886a5287)
1--TEST--
2GH-16604 (Memory leaks in SPL constructors) - SplFileObject
3--FILE--
4<?php
5
6file_put_contents(__DIR__.'/gh16604_2.tmp', 'hello');
7
8$obj = new SplFileObject(__DIR__.'/gh16604_2.tmp');
9try {
10    $obj->__construct(__DIR__.'/gh16604_2.tmp');
11} catch (Error $e) {
12    echo $e->getMessage(), "\n";
13}
14
15?>
16--CLEAN--
17<?php
18@unlink(__DIR__.'/gh16604_2.tmp');
19?>
20--EXPECT--
21Cannot call constructor twice
22