xref: /PHP-8.2/ext/spl/tests/gh8318.phpt (revision dbf1cafd)
1--TEST--
2GH-8318 (SplFileObject useless call to an internal method for erroring)
3--FILE--
4<?php
5class bug8318 extends \SplFileObject
6{
7    public function __construct()
8    {
9    }
10
11    public function fpassthru(): int
12    {
13        return 0;
14    }
15}
16
17$cl = new bug8318;
18try {
19    $cl->fpassthru();
20} catch (\Error $e) {
21    var_dump($e);
22}
23?>
24--EXPECTF--
25object(Error)#2 (7) {
26  ["message":protected]=>
27  string(72) "The parent constructor was not called: the object is in an invalid state"
28  ["string":"Error":private]=>
29  string(0) ""
30  ["code":protected]=>
31  int(0)
32  ["file":protected]=>
33  string(%d) "%s"
34  ["line":protected]=>
35  int(16)
36  ["trace":"Error":private]=>
37  array(0) {
38  }
39  ["previous":"Error":private]=>
40  NULL
41}
42