Bug #70997 [NEW]: When using parentClass:: instead of parent::, static context changed.
| From: | arjen at parse dot nl | Date: | Mon, 30 Nov 2015 09:29:19 +0000 |
| Subject: | Bug #70997 [NEW]: When using parentClass:: instead of parent::, static context changed. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197511@lists.php.net to get a copy of this message | ||
From: arjen at parse dot nl
Operating system: Linux
PHP version: 7.0.0RC8
Package: Scripting Engine problem
Bug Type: Bug
Bug description:When using parentClass:: instead of parent::, static context changed.
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 bug report at https://bugs.php.net/bug.php?id=70997&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70997&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70997&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70997&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70997&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70997&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70997&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70997&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70997&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70997&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70997&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70997&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70997&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70997&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70997&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70997&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70997&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70997&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70997&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70997&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70997&r=mysqlcfg