Re: Re: [RFC] Static variables in inherited methods

From: Date: Wed, 17 Mar 2021 18:56:20 +0000
Subject: Re: Re: [RFC] Static variables in inherited methods
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-113594@lists.php.net to get a copy of this message
On Wed, Mar 17, 2021, 19:05 Nikita Popov <nikita.ppv@gmail.com> wrote: > On Wed, Mar 17, 2021 at 5:48 PM Alexandru Pătrănescu <drealecs@gmail.com> > wrote: > >> >> On Wed, Mar 17, 2021 at 5:30 PM Nikita Popov <nikita.ppv@gmail.com> >> wrote: >> >>> On Tue, Feb 23, 2021 at 3:01 PM Nikita Popov <nikita.ppv@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: >>> > >>> > µ¶Ø¼}c“… >>> > ú9+~·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

« previous php.internals (#113594) next »