Bug #79354 [Com]: Fatal error: Anonymous class wasn't preloaded when using opcache preload
| From: | laurent35240 at gmail dot com | Date: | Mon, 09 Mar 2020 19:17:55 +0000 |
| Subject: | Bug #79354 [Com]: Fatal error: Anonymous class wasn't preloaded when using opcache preload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225987@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79354&edit=1
ID: 79354
Comment by: laurent35240 at gmail dot com
Reported by: laurent35240 at gmail dot com
Summary: Fatal error: Anonymous class wasn't preloaded when
using opcache preload
Status: Open
Type: Bug
Package: opcache
Operating System: *nix
PHP Version: 7.4.3
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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