Bug #76451 [Asn->Csd]: Aliases during inheritance type checks affected by opcache
| From: | nikic@php.net | Date: | Fri, 24 May 2019 11:00:16 +0000 |
| Subject: | Bug #76451 [Asn->Csd]: Aliases during inheritance type checks affected by opcache | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220980@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76451&edit=1
ID: 76451
Updated by: nikic@php.net
Reported by: nikic@php.net
Summary: Aliases during inheritance type checks affected by
opcache
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: master-Git-2018-06-11 (Git)
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Fixed in 7.4 with https://github.com/php/php-src/commit/afec3a9208c2a34762a87cb797f28e7e61c88cca.
Previous Comments:
------------------------------------------------------------------------
[2018-10-04 18:13:28] nikic@php.net
Related To: Bug #76973
------------------------------------------------------------------------
[2018-06-11 20:07:35] nikic@php.net
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 this bug report at https://bugs.php.net/bug.php?id=76451&edit=1