rfc:debug_backtrace_depth
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:debug_backtrace_depth [2021/03/13 18:10] – tandre | rfc:debug_backtrace_depth [2025/04/03 13:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2021-03-13 | * Date: 2021-03-13 | ||
* Author: Tyson Andre, tandre@php.net | * Author: Tyson Andre, tandre@php.net | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
* Implementation: | * Implementation: | ||
Line 110: | Line 110: | ||
===== Proposed PHP Version ===== | ===== Proposed PHP Version ===== | ||
8.1 | 8.1 | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | ==== Limited to a specific use case ==== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | < | ||
+ | There hasn't been much discussion on this one, probably because the | ||
+ | functionality and use cases are so specific. I'm not really convinced by | ||
+ | your examples. | ||
+ | |||
+ | For the purpose of printing debug logs, using an engine-provided depth is | ||
+ | non-ideal, because any intermediate helper functions will count towards the | ||
+ | depth. Tracking your own depth will result in a more meaningful/ | ||
+ | output. | ||
+ | |||
+ | For tracking down infinite recursion, isn't this what the xdebug recursion | ||
+ | limit is for? You'll directly get your recursive stack trace, which should | ||
+ | make it obvious where the infinite recursion occurs. Using | ||
+ | debug_backtrace_depth() for this purpose means that you actually already | ||
+ | need to know where you are infinitely recursing in order to place the guard. | ||
+ | |||
+ | If you want to find places where your code would hit the xdebug recursion | ||
+ | limit, then why not run it under xdebug and find out, rather than trying to | ||
+ | simulate the same behavior manually? That again requires that you actually | ||
+ | place relevant guards in the first place, which makes this another chicken | ||
+ | and egg problem. | ||
+ | </ | ||
+ | |||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Yes/No, requiring a 2/3 majority | Yes/No, requiring a 2/3 majority |
rfc/debug_backtrace_depth.1615659017.txt.gz · Last modified: 2025/04/03 13:08 (external edit)