xref: /PHP-8.2/Zend/tests/bug63762.phpt (revision 6e16e1da)
1--TEST--
2Bug #63762 - Sigsegv when Exception::$trace is changed by user
3--FILE--
4<?php
5$e = new Exception();
6
7$ref = new ReflectionProperty($e, 'trace');
8
9echo "Array of NULL:\n";
10$ref->setValue($e, array(NULL));
11
12var_dump($e->getTraceAsString());
13
14echo "\nArray of empty array:\n";
15$ref->setValue($e, array(array()));
16var_dump($e->getTraceAsString());
17
18echo "\nArray of array of NULL values:\n";
19$ref->setValue($e, array(array(
20    'file'  => NULL,
21    'line'  => NULL,
22    'class' => NULL,
23    'type'  => NULL,
24    'function' => NULL,
25    'args'  => NULL
26)));
27var_dump($e->getTraceAsString());
28?>
29--EXPECTF--
30Array of NULL:
31
32Warning: Expected array for frame 0 in %s on line %d
33string(9) "#0 {main}"
34
35Array of empty array:
36string(36) "#0 [internal function]: ()
37#1 {main}"
38
39Array of array of NULL values:
40
41Warning: File name is not a string in %s on line %d
42
43Warning: Value for class is not a string in %s on line %d
44
45Warning: Value for type is not a string in %s on line %d
46
47Warning: Value for function is not a string in %s on line %d
48
49Warning: args element is not an array in %s on line %d
50string(58) "#0 [unknown file]: [unknown][unknown][unknown]()
51#1 {main}"
52