xref: /PHP-5.5/Zend/tests/bug50383.phpt (revision f867fadd)
1--TEST--
2Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace)
3--FILE--
4<?php
5
6class myClass {
7	public static function __callStatic($method, $args) {
8		throw new Exception("Missing static method '$method'\n");
9	}
10	public function __call($method, $args) {
11		throw new Exception("Missing method '$method'\n");
12	}
13}
14
15function thrower() {
16	myClass::ThrowException();
17}
18function thrower2() {
19	$x = new myClass;
20	$x->foo();
21}
22
23try {
24	thrower();
25} catch(Exception $e) {
26	print $e->getMessage();
27	print_r($e->getTrace());
28}
29
30try {
31	thrower2();
32} catch (Exception $e) {
33	print $e->getMessage();
34	print_r($e->getTrace());
35}
36
37?>
38--EXPECTF--
39Missing static method 'ThrowException'
40Array
41(
42    [0] => Array
43        (
44            [file] => %s
45            [line] => 13
46            [function] => __callStatic
47            [class] => myClass
48            [type] => ::
49            [args] => Array
50                (
51                    [0] => ThrowException
52                    [1] => Array
53                        (
54                        )
55
56                )
57
58        )
59
60    [1] => Array
61        (
62            [file] => %s
63            [line] => 13
64            [function] => ThrowException
65            [class] => myClass
66            [type] => ::
67            [args] => Array
68                (
69                )
70
71        )
72
73    [2] => Array
74        (
75            [file] => %s
76            [line] => 21
77            [function] => thrower
78            [args] => Array
79                (
80                )
81
82        )
83
84)
85Missing method 'foo'
86Array
87(
88    [0] => Array
89        (
90            [file] => %s
91            [line] => 17
92            [function] => __call
93            [class] => myClass
94            [type] => ->
95            [args] => Array
96                (
97                    [0] => foo
98                    [1] => Array
99                        (
100                        )
101
102                )
103
104        )
105
106    [1] => Array
107        (
108            [file] => %s
109            [line] => 17
110            [function] => foo
111            [class] => myClass
112            [type] => ->
113            [args] => Array
114                (
115                )
116
117        )
118
119    [2] => Array
120        (
121            [file] => %s
122            [line] => 28
123            [function] => thrower2
124            [args] => Array
125                (
126                )
127
128        )
129
130)
131