Skip to content

Commit 523965c

Browse files
committed
extend test
1 parent 10b3a4f commit 523965c

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

Zend/tests/gh7922.phpt

+26-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,40 @@ GH-7922 (print_r should not produce a fatal error)
44
<?php
55
class A
66
{
7-
public function __debugInfo(): array
7+
public function __debugInfo()
88
{
99
throw new \Error('x');
1010
}
1111
}
1212

1313
try {
1414
$a = new A();
15+
print_r($a);
16+
} catch (\Throwable $e) {
17+
echo (string) $e . "\n";
18+
}
19+
20+
try {
21+
$a = new class() extends A {
22+
public function __debugInfo(): array
23+
{
24+
throw new \Exception('y');
25+
}
26+
};
1527
print_r($a, true);
1628
} catch (\Throwable $e) {
17-
echo $e->getMessage();
29+
echo (string) $e . "\n";
1830
}
1931
?>
20-
--EXPECT--
21-
__debuginfo() must return an array
32+
--EXPECTF--
33+
Error: x in %s:6
34+
Stack trace:
35+
#0 [internal function]: A->__debugInfo()
36+
#1 %s(12): print_r(Object(A))
37+
#2 {main}
38+
39+
Exception: y in %s:21
40+
Stack trace:
41+
#0 [internal function]: A@anonymous->__debugInfo()
42+
#1 %s(24): print_r(Object(A@anonymous), true)
43+
#2 {main}

0 commit comments

Comments
 (0)