Re: static:: and PHP 7 (from bug #70997)
| From: | Peter Cowburn | Date: | Mon, 30 Nov 2015 12:18:11 +0000 |
| Subject: | Re: static:: and PHP 7 (from bug #70997) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89491@lists.php.net to get a copy of this message | ||
On 30 November 2015 at 12:16, Peter Cowburn <petercowburn@gmail.com> wrote:
> Hi internals,
>
> I'm looking for some feedback on a change with regard to static::, which
> has been present throughout the 7 branch.
>
> Have a look-see at https://bugs.php.net/bug.php?id=70997
>
> <?php
>
> class A {
> const TEST = false;
> public function test() {
> var_dump(static::TEST);
> }
> }
>
> class B extends A {
> const TEST = true;
>
> public function test() {
> A::test();
> }
> }
>
> $b = new B;
> $b->test();
>
> ?>
>
> In PHP 7 it dumps true, in PHP 5 false.
>
Gah, this was inevitable! In PHP 7 it dumps FALSE, in PHP 5 TRUE. Stupid
brain.
>
> I'm looking for info on when, where, why it was introduced, and ultimately
> some clarification of:
> a) was this intentional
> b) it is going to stay (i.e. "not a bug")
> c) some more to go on so I can document the change clearly
>
> If there is already a line in NEWS/UPGRADING or a commit you can point me
> to, that would be amazing.
>
> Whatever tangents this topic wanders off on, I'd like to eventually pull
> it back to the bug report mentioned above with one eye on formulating the
> docs changes (if it's really "not a bug").
>
> Cheers,
>
> A docs guy.
>
>