On Wed, 19 Oct 2022, 19:04 David Rodrigues, <david.pro...@gmail.com> wrote:

> Hello!
>
> I'm converting my code to use short closures where possible, and I ran into
> a problem using compact().
>
> Basically, the names used in compact() cannot be accessed due to a bug,
> reported in 2019 still in PHP 7.4 (ID 78970).
>
> https://bugs.php.net/bug.php?id=78970
>
> It seems to me to be a reasonable problem and one that needs attention, as
> the message is not that "compact cannot be used here", but that "the
> variable does not exist".
>
> The code below may reproduce the problem:
>
> $x = 123;
> (fn() => compact('x'))();
>
> https://3v4l.org/AFARs
>
> Is there any possibility of this being fixed? I would love to help, but I
> don't have much C programming skills, unfortunately.
>

I'd rather hope for `compact()` to finally be deprecated and targeted for
removal 😛

The fact that it still exists precludes (or at least complicates) future
optimization of scope + inlining in the engine.

Similar thoughts towards `extract()`, I'd say.

Reply via email to