Re: Re: [RFC][DISCUSSION] debug_backtrace alternative as an array of StackFrame objects
| From: | Nikita Popov | Date: | Tue, 21 Jul 2020 08:41:39 +0000 |
| Subject: | Re: Re: [RFC][DISCUSSION] debug_backtrace alternative as an array of StackFrame objects | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111089@lists.php.net to get a copy of this message | ||
On Tue, Jul 21, 2020 at 7:14 AM Michał Marcin Brzuchalski <
michal.brzuchalski@gmail.com> wrote:
> wt., 21 lip 2020 o 07:07 tyson andre <tysonandre775@hotmail.com>
> napisał(a):
>
> > > Can you give an example of an internal stack frame?
> >
> > A stack frame that was created by a PHP internal function instead of by
> > userland code, i.e. one without a file in the frame.
> > Related to
> >
> > https://github.com/php/php-src/pull/5820#pullrequestreview-452080212
> >
> >
> > ```
> > php > array_map(fn() => $GLOBALS['x'] = StackFrame::getTrace()[0], [2]);
> > php > var_export($x);
> > StackFrame::__set_state(array(
> > 'file' => NULL,
> > 'line' => NULL,
> > 'function' => '{closure}',
> > 'class' => NULL,
> > 'type' => NULL,
> > 'object' => NULL,
> > 'object_class' => NULL,
> > 'closure' => NULL,
> > 'args' =>
> > array (
> > 0 => 2,
> > ),
> > ))
> > ```
> >
>
> The RFC has been adjusted regarding the nullability of file and line
> properties and related getter methods.
>
> Is there anything else stopping it from getting up to the vote?
>
> Cheers,
> Michał
>
Why does StackFrame define both public typed properties *and* getter
methods? One or the other would make sense to me, but not both.
Nikita