Re: [RFC] debug_backtrace_depth(int $limit=0): int

From: Date: Sat, 27 Mar 2021 20:45:59 +0000
Subject: Re: [RFC] debug_backtrace_depth(int $limit=0): int
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-113819@lists.php.net to get a copy of this message
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?

I plan to start voting on https://wiki.php.net/rfc/debug_backtrace_depth
tomorrow.

Thanks,
Tyson


Thread (3 messages)

« previous php.internals (#113819) next »