Bug #70997 [Opn]: When using parentClass:: instead of parent::, static context changed.
| From: | laruence@php.net | Date: | Mon, 30 Nov 2015 10:51:18 +0000 |
| Subject: | Bug #70997 [Opn]: When using parentClass:: instead of parent::, static context changed. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12894@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70997&edit=1
ID: 70997
Updated by: laruence@php.net
Reported by: arjen at parse dot nl
Summary: When using parentClass:: instead of parent::, static
context changed.
Status: Open
Type: Bug
-Package: Scripting Engine problem
+Package: Documentation problem
Operating System: Linux
PHP Version: 7.0.0RC8
Block user comment: N
Private report: N
New Comment:
I think this is not a bug, but a improvement, as you already call explicit A::test, which means, you
are expecting A's scope ..
so, change to document problem.
thanks
Previous Comments:
------------------------------------------------------------------------
[2015-11-30 09:29:17] arjen at parse dot nl
Description:
------------
Compared to 5.x. Behaviour of LSB (?) changed, bug or not documented?
I cannot find anything about this subtle change in the 7.0 migration guide
(http://php.net/manual/en/migration70.incompatible.php) nor in the 7.0 NEWS file.
See https://3v4l.org/edVna
I know it's easy to fix in the codebase, but it would be nice if this changed is documented
when intended or original behavior restored.
Test script:
---------------
<?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();
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70997&edit=1