xref: /PHP-8.2/Zend/tests/gh16188.phpt (revision c2115a43)
1--TEST--
2GH-16188 (Assertion failure in Zend/zend_exceptions.c)
3--FILE--
4<?php
5
6$re = new TypeError();
7array_walk($re, function (&$item, $key) use (&$re) {
8    if ($key === "\x00Error\x00previous") {
9        $item = new Exception();
10    }
11});
12printf("getTraceAsString:\n%s\n\n", $re->getTraceAsString());
13printf("getPrevious:\n%s\n\n", get_class($re->getPrevious()));
14printf("__toString:\n%s\n\n", $re);
15
16?>
17==DONE==
18--EXPECTF--
19getTraceAsString:
20#0 {main}
21
22getPrevious:
23Exception
24
25__toString:
26Exception in %s:%d
27Stack trace:%A
28#%d {main}
29
30Next TypeError in %s:%d
31Stack trace:%A
32#%d {main}
33
34==DONE==
35