Bug #79354 [Opn->Dup]: Fatal error: Anonymous class wasn't preloaded when using opcache preload
Edit report at https://bugs.php.net/bug.php?id=79354&edit=1
ID: 79354
Updated by: nikic@php.net
Reported by: laurent35240 at gmail dot com
Summary: Fatal error: Anonymous class wasn't preloaded when
using opcache preload
-Status: Open
+Status: Duplicate
Type: Bug
Package: opcache
Operating System: *nix
PHP Version: 7.4.3
Block user comment: N
Private report: N
New Comment:
Closing this as a duplicate of bug #79349, for which I have attached a patch.
Previous Comments:
------------------------------------------------------------------------
[2020-03-09 19:17:54] laurent35240 at gmail dot com
Yes this is the same issue. Sorry I didn't see it before.
I also had this issue when using symfony and worked on providing a simpler example without symfony
------------------------------------------------------------------------
[2020-03-09 17:32:19] cmb@php.net
This looks related to bug #79349.
------------------------------------------------------------------------
[2020-03-08 21:13:37] laurent35240 at gmail dot com
Description:
------------
When using opcache preload, I got this message when running my code "Fatal error: Anonymous
class wasn't preloaded"
This happens when there is usage of an anonymous class extending a class that was not preloaded (cf
test script)
I reproduced this issue with version 7.4.3 of PHP with cli and php-fpm on Mac and Linux
Test script:
---------------
I tried to gather a test script here: https://github.com/laurent35240/test-opcache-preload
Basically, you need to have a class using a anonymous class like in this example
class A
{
public function getChildOfB() {
return new class () extends B {};
}
}
And put only class A and not class B in your opcache preload file.
Running a script calling A::getChildofB will then fail with a fatal error.
Expected result:
----------------
No Fatal Error
Actual result:
--------------
Fatal error: Anonymous class wasn't preloaded
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79354&edit=1
Thread (4 messages)