1--TEST--
2debug_backtrace options
3--FILE--
4<?php
5
6function backtrace_print($opt = null)
7{
8    if(is_null($opt)) {
9        print_r(debug_backtrace());
10    } else {
11        print_r(debug_backtrace($opt));
12    }
13}
14
15function doit($a, $b, $how)
16{
17    echo "==default\n";
18    $how();
19    echo "==true\n";
20    $how(true);
21    echo "==false\n";
22    $how(false);
23    echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
24    $how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
25    echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
26    $how(DEBUG_BACKTRACE_IGNORE_ARGS);
27    echo "==both\n";
28    $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS);
29}
30
31class foo {
32    protected function doCall($dowhat, $how)
33    {
34       $dowhat('a','b', $how);
35    }
36    static function statCall($dowhat, $how)
37    {
38        $obj = new self();
39        $obj->doCall($dowhat, $how);
40    }
41}
42foo::statCall("doit", "debug_print_backtrace");
43foo::statCall("doit", "backtrace_print");
44
45?>
46--EXPECTF--
47==default
48#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
49#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
50#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
51==true
52#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
53#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
54#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
55==false
56#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
57#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
58#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
59==DEBUG_BACKTRACE_PROVIDE_OBJECT
60#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
61#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
62#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
63==DEBUG_BACKTRACE_IGNORE_ARGS
64#0 %sdebug_backtrace_options.php(%d): doit()
65#1 %sdebug_backtrace_options.php(%d): foo->doCall()
66#2 %sdebug_backtrace_options.php(%d): foo::statCall()
67==both
68#0 %sdebug_backtrace_options.php(%d): doit()
69#1 %sdebug_backtrace_options.php(%d): foo->doCall()
70#2 %sdebug_backtrace_options.php(%d): foo::statCall()
71==default
72Array
73(
74    [0] => Array
75        (
76            [file] => %sdebug_backtrace_options.php
77            [line] => %d
78            [function] => backtrace_print
79            [args] => Array
80                (
81                )
82
83        )
84
85    [1] => Array
86        (
87            [file] => %sdebug_backtrace_options.php
88            [line] => %d
89            [function] => doit
90            [args] => Array
91                (
92                    [0] => a
93                    [1] => b
94                    [2] => backtrace_print
95                )
96
97        )
98
99    [2] => Array
100        (
101            [file] => %sdebug_backtrace_options.php
102            [line] => %d
103            [function] => doCall
104            [class] => foo
105            [object] => foo Object
106                (
107                )
108
109            [type] => ->
110            [args] => Array
111                (
112                    [0] => doit
113                    [1] => backtrace_print
114                )
115
116        )
117
118    [3] => Array
119        (
120            [file] => %sdebug_backtrace_options.php
121            [line] => %d
122            [function] => statCall
123            [class] => foo
124            [type] => ::
125            [args] => Array
126                (
127                    [0] => doit
128                    [1] => backtrace_print
129                )
130
131        )
132
133)
134==true
135Array
136(
137    [0] => Array
138        (
139            [file] => %sdebug_backtrace_options.php
140            [line] => 17
141            [function] => backtrace_print
142            [args] => Array
143                (
144                    [0] => 1
145                )
146
147        )
148
149    [1] => Array
150        (
151            [file] => %sdebug_backtrace_options.php
152            [line] => %d
153            [function] => doit
154            [args] => Array
155                (
156                    [0] => a
157                    [1] => b
158                    [2] => backtrace_print
159                )
160
161        )
162
163    [2] => Array
164        (
165            [file] => %sdebug_backtrace_options.php
166            [line] => %d
167            [function] => doCall
168            [class] => foo
169            [object] => foo Object
170                (
171                )
172
173            [type] => ->
174            [args] => Array
175                (
176                    [0] => doit
177                    [1] => backtrace_print
178                )
179
180        )
181
182    [3] => Array
183        (
184            [file] => %sdebug_backtrace_options.php
185            [line] => %d
186            [function] => statCall
187            [class] => foo
188            [type] => ::
189            [args] => Array
190                (
191                    [0] => doit
192                    [1] => backtrace_print
193                )
194
195        )
196
197)
198==false
199Array
200(
201    [0] => Array
202        (
203            [file] => %sdebug_backtrace_options.php
204            [line] => 19
205            [function] => backtrace_print
206            [args] => Array
207                (
208                    [0] =>
209                )
210
211        )
212
213    [1] => Array
214        (
215            [file] => %sdebug_backtrace_options.php
216            [line] => %d
217            [function] => doit
218            [args] => Array
219                (
220                    [0] => a
221                    [1] => b
222                    [2] => backtrace_print
223                )
224
225        )
226
227    [2] => Array
228        (
229            [file] => %sdebug_backtrace_options.php
230            [line] => %d
231            [function] => doCall
232            [class] => foo
233            [type] => ->
234            [args] => Array
235                (
236                    [0] => doit
237                    [1] => backtrace_print
238                )
239
240        )
241
242    [3] => Array
243        (
244            [file] => %sdebug_backtrace_options.php
245            [line] => %d
246            [function] => statCall
247            [class] => foo
248            [type] => ::
249            [args] => Array
250                (
251                    [0] => doit
252                    [1] => backtrace_print
253                )
254
255        )
256
257)
258==DEBUG_BACKTRACE_PROVIDE_OBJECT
259Array
260(
261    [0] => Array
262        (
263            [file] => %sdebug_backtrace_options.php
264            [line] => 21
265            [function] => backtrace_print
266            [args] => Array
267                (
268                    [0] => 1
269                )
270
271        )
272
273    [1] => Array
274        (
275            [file] => %sdebug_backtrace_options.php
276            [line] => %d
277            [function] => doit
278            [args] => Array
279                (
280                    [0] => a
281                    [1] => b
282                    [2] => backtrace_print
283                )
284
285        )
286
287    [2] => Array
288        (
289            [file] => %sdebug_backtrace_options.php
290            [line] => %d
291            [function] => doCall
292            [class] => foo
293            [object] => foo Object
294                (
295                )
296
297            [type] => ->
298            [args] => Array
299                (
300                    [0] => doit
301                    [1] => backtrace_print
302                )
303
304        )
305
306    [3] => Array
307        (
308            [file] => %sdebug_backtrace_options.php
309            [line] => %d
310            [function] => statCall
311            [class] => foo
312            [type] => ::
313            [args] => Array
314                (
315                    [0] => doit
316                    [1] => backtrace_print
317                )
318
319        )
320
321)
322==DEBUG_BACKTRACE_IGNORE_ARGS
323Array
324(
325    [0] => Array
326        (
327            [file] => %sdebug_backtrace_options.php
328            [line] => 23
329            [function] => backtrace_print
330        )
331
332    [1] => Array
333        (
334            [file] => %sdebug_backtrace_options.php
335            [line] => %d
336            [function] => doit
337        )
338
339    [2] => Array
340        (
341            [file] => %sdebug_backtrace_options.php
342            [line] => %d
343            [function] => doCall
344            [class] => foo
345            [type] => ->
346        )
347
348    [3] => Array
349        (
350            [file] => %sdebug_backtrace_options.php
351            [line] => %d
352            [function] => statCall
353            [class] => foo
354            [type] => ::
355        )
356
357)
358==both
359Array
360(
361    [0] => Array
362        (
363            [file] => %sdebug_backtrace_options.php
364            [line] => 25
365            [function] => backtrace_print
366        )
367
368    [1] => Array
369        (
370            [file] => %sdebug_backtrace_options.php
371            [line] => %d
372            [function] => doit
373        )
374
375    [2] => Array
376        (
377            [file] => %sdebug_backtrace_options.php
378            [line] => %d
379            [function] => doCall
380            [class] => foo
381            [object] => foo Object
382                (
383                )
384
385            [type] => ->
386        )
387
388    [3] => Array
389        (
390            [file] => %sdebug_backtrace_options.php
391            [line] => %d
392            [function] => statCall
393            [class] => foo
394            [type] => ::
395        )
396
397)
398