Re: [RFC][Discussion] Closure optimizations
| From: | Ilija Tovilo | Date: | Sat, 31 Jan 2026 16:32:48 +0000 |
| Subject: | Re: [RFC][Discussion] Closure optimizations | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129966@lists.php.net to get a copy of this message | ||
Hi Bob
On Sat, Jan 31, 2026 at 4:59 AM Bob Weinand <bobwei9@hotmail.com> wrote:
>
> On 31.1.2026 00:40:05, Ilija Tovilo wrote:
>
> https://wiki.php.net/rfc/closure-optimizations
>
> I'm a bit disappointed that you felt necessary to introduce bureaucracy for a
> straightforward very minor BC break. I don't like this something to become necessary or
> expected in future. Sending that email was completely sufficient.
>
> I would like to encourage you to recognize that and simply merge your pull request.
I agree that the BC break is fairly minimal. What made me decide to
create an RFC after all is highlighted here:
> ReflectionFunction::getClosureThis() will now return NULL for closures that are inferred as
> static. This might be slightly surprising, given static inference does not work 100% reliably,
> limited by the rules previously described.
ReflectionFunction::getClosureThis() will work as long as the closure
uses $this, but it will also work if it calls static methods. Once you
remove the static call, it will break. Now, I don't think
ReflectionFunction::getClosureThis() is something many people rely on,
nor should they, but it is nonetheless surprising. I'd like to avoid
the situation where this is categorized as a bug that is effectively
impossible to solve without removing the optimization.
Ilija