Hi internals, I've created a new RFC https://wiki.php.net/rfc/debug_backtrace_depth to return the depth of the current stack trace.
Inspecting the current stack trace depth is occasionally useful for 1. Manually debugging with temporary debug statements 2. Checking for potential infinite recursion or investigating reproducible reports of infinite recursion 3. Checking if code is likely to hit stack frame limits when run in environments using extensions such as Xdebug (https://xdebug.org/docs/all_settings#max_nesting_level , which also checks for potential infinite recursion) (note that Xdebug is a debugger - running php under xdebug is significantly slower than without Xdebug) It is currently possible to compute the depth through `count(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $limit=0))`, but this is verbose, inefficient, and harder to read compared to returning the depth directly. Thoughts? Thanks, - Tyson -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php