On Wed, Mar 17, 2021, 19:05 Nikita Popov <nikita....@gmail.com> wrote:
> On Wed, Mar 17, 2021 at 5:48 PM Alexandru Pătrănescu <dreal...@gmail.com> > wrote: > >> >> On Wed, Mar 17, 2021 at 5:30 PM Nikita Popov <nikita....@gmail.com> >> wrote: >> >>> On Tue, Feb 23, 2021 at 3:01 PM Nikita Popov <nikita....@gmail.com> >>> wrote: >>> >>> > Hi internals, >>> > >>> > While looking into various issues related to static variable handling, >>> > I've become increasingly convinced that our handling of static >>> variables in >>> > inherited methods is outright buggy. However, it's also long-standing >>> > behavior, so I've put up an RFC: >>> > >>> > https://wiki.php.net/rfc/static_variable_inheritance >>> > >>> >>> I have now created an implementation for this change, and updated the RFC >>> with some sample code for how one can preserve the old behavior, if it's >>> being used deliberately. I plan to move forward with voting soon. >>> >> >> Maybe it would be good to have links to some bug reports (that you >> mentioned) or a code snippet like this https://3v4l.org/J8Mme >> to clearly show that copying the static variable happens on inheritance >> point, with whatever that variable was at that point >> so it would be clear that the current behavior is undefined considering >> only B class, if it would be to ignore what happened to A in the meantime. >> >> Thanks, >> Alex >> > > We already changed that behavior for PHP 8.1 independently of this RFC -- > static variables will no longer depend on point of inheritance. This RFC is > in addition to that change (and subsumes it really, because point of > inheritance cannot matter anymore.) > > Regards, > Nikita > Right, thanks for explaining. I remembered I saw it on mentioned somewhere but didn't know exactly where. Searched it now and it was this PR: https://github.com/php/php-src/pull/6705 Thank you, Alex