forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional argument to debug_backtrace() and debug_print_backtrace(…
…) to limit the amount of stack frames returned.
- Loading branch information
1 parent
efcb9a7
commit 6f3148d
Showing
7 changed files
with
189 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
--TEST-- | ||
debug_backtrace limit | ||
--FILE-- | ||
<?php | ||
function a() { | ||
b(); | ||
} | ||
|
||
function b() { | ||
c(); | ||
} | ||
|
||
function c() { | ||
print_r(debug_backtrace(0, 1)); | ||
print_r(debug_backtrace(0, 2)); | ||
print_r(debug_backtrace(0, 0)); | ||
print_r(debug_backtrace(0, 4)); | ||
} | ||
|
||
a(); | ||
?> | ||
--EXPECTF-- | ||
Array | ||
( | ||
[0] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 7 | ||
[function] => c | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
) | ||
Array | ||
( | ||
[0] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 7 | ||
[function] => c | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
[1] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 3 | ||
[function] => b | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
) | ||
Array | ||
( | ||
[0] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 7 | ||
[function] => c | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
[1] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 3 | ||
[function] => b | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
[2] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 17 | ||
[function] => a | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
) | ||
Array | ||
( | ||
[0] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 7 | ||
[function] => c | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
[1] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 3 | ||
[function] => b | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
[2] => Array | ||
( | ||
[file] => %s/debug_backtrace_limit.php | ||
[line] => 17 | ||
[function] => a | ||
[args] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--TEST-- | ||
debug_print_backtrace limit | ||
--FILE-- | ||
<?php | ||
function a() { | ||
b(); | ||
} | ||
|
||
function b() { | ||
c(); | ||
} | ||
|
||
function c() { | ||
debug_print_backtrace(0, 1); | ||
debug_print_backtrace(0, 2); | ||
debug_print_backtrace(0, 0); | ||
debug_print_backtrace(0, 4); | ||
} | ||
|
||
a(); | ||
?> | ||
--EXPECTF-- | ||
#0 c() called at [%s/debug_print_backtrace_limit.php:7] | ||
#0 c() called at [%s/debug_print_backtrace_limit.php:7] | ||
#1 b() called at [%s/debug_print_backtrace_limit.php:3] | ||
#0 c() called at [%s/debug_print_backtrace_limit.php:7] | ||
#1 b() called at [%s/debug_print_backtrace_limit.php:3] | ||
#2 a() called at [%s/debug_print_backtrace_limit.php:17] | ||
#0 c() called at [%s/debug_print_backtrace_limit.php:7] | ||
#1 b() called at [%s/debug_print_backtrace_limit.php:3] | ||
#2 a() called at [%s/debug_print_backtrace_limit.php:17] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters