Bug #76451 [NEW]: Aliases during inheritance type checks affected by opcache
| From: | nikic@php.net | Date: | Mon, 11 Jun 2018 20:07:36 +0000 |
| Subject: | Bug #76451 [NEW]: Aliases during inheritance type checks affected by opcache | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-215626@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: master-Git-2018-06-11 (Git)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Aliases during inheritance type checks affected by opcache
Description:
------------
If type-equality checks during inheritance fail on simple string
comparison, they fall back to loaded the class entries and comparing
those. This allows aliased classes to pass inheritance checks.
However, if classes are early-bound, then the alias will not be
available if opcache is used, as compilation is isolated.
The attached test script will work without opcache and fail with
opcache.
Test script:
---------------
// file1.php
<?php
class Foo {}
class_alias('Foo', 'Bar');
require __DIR__ . '/file2.php';
// file2.php
<?php
class A {
public function test(Foo $foo) {}
}
class B extends A {
public function test(Bar $foo) {}
}
Expected result:
----------------
No error.
Actual result:
--------------
Warning: Declaration of B::test(Bar $foo) should be compatible with
A::test(Foo $foo)
--
Edit bug report at https://bugs.php.net/bug.php?id=76451&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76451&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76451&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76451&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76451&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76451&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76451&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76451&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76451&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76451&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76451&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76451&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76451&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76451&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76451&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76451&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76451&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76451&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76451&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76451&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76451&r=mysqlcfg