xref: /PHP-5.4/Zend/tests/bug63762.phpt (revision a11606b1)
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$ref->setAccessible(TRUE);
9
10echo "Array of NULL:\n";
11$ref->setValue($e, array(NULL));
12
13var_dump($e->getTraceAsString());
14
15echo "\nArray of empty array:\n";
16$ref->setValue($e, array(array()));
17var_dump($e->getTraceAsString());
18
19echo "\nArray of array of NULL values:\n";
20$ref->setValue($e, array(array(
21    'file'  => NULL,
22    'line'  => NULL,
23    'class' => NULL,
24    'type'  => NULL,
25    'function' => NULL,
26    'args'  => NULL
27)));
28var_dump($e->getTraceAsString());
29?>
30--EXPECTF--
31Array of NULL:
32
33Warning: Expected array for frame 0 in %s on line %d
34string(9) "#0 {main}"
35
36Array of empty array:
37string(36) "#0 [internal function]: ()
38#1 {main}"
39
40Array of array of NULL values:
41
42Warning: Function name is no string in %s on line %d
43
44Warning: Value for class is no string in %s on line %d
45
46Warning: Value for type is no string in %s on line %d
47
48Warning: Value for function is no string in %s on line %d
49
50Warning: args element is no array in %s on line %d
51string(60) "#0 [unknown function][unknown][unknown][unknown]()
52#1 {main}"
53
54