Bug #79349 [PATCH]: Unlinked anonymous classes prevent using preloading
Edit report at https://bugs.php.net/bug.php?id=79349&edit=1
ID: 79349
Patch added by: nikic@php.net
Reported by: nicolasgrekas@php.net
Summary: Unlinked anonymous classes prevent using preloading
Status: Open
Type: Bug
Package: opcache
PHP Version: 7.4.3
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix bug #79349: Unlinked anonymous classes prevent using preloading
On GitHub: https://github.com/php/php-src/pull/5257
Patch: https://github.com/php/php-src/pull/5257.patch
Previous Comments:
------------------------------------------------------------------------
[2020-03-09 17:32:19] cmb@php.net
Related To: Bug #79354
------------------------------------------------------------------------
[2020-03-05 11:19:47] nicolasgrekas@php.net
Maybe all missing symbols could trigger the autoloader before linking happens?
------------------------------------------------------------------------
[2020-03-05 11:15:30] nicolasgrekas@php.net
Of course, using regular class autoloading would work also instead of the current error.
------------------------------------------------------------------------
[2020-03-05 11:09:16] nicolasgrekas@php.net
The first affect class is this one:
https://github.com/symfony/symfony/blob/7c90c8ba84f24e3d4b62c02eeb8b14ce23eff59f/src/Symfony/Component/HttpKernel/Kernel.php#L459
> $cache = new class($cachePath, $this->debug) extends ConfigCache {
Right now, this anonymous class cannot be linked during preloading because the ConfigCache is not
available. Then, at runtime, when the code path is hit, the error occurs.
I wish there would be a way to discover programmatically that the ConfigCache class is required so
that it could be loaded.
Apparently, there is one internally, since opcache is able to trigger this warning:
> Can't preload unlinked class class@anonymous: Unknown parent
> Symfony\Component\Config\ConfigCache
But that's too late for me to do anything about it.
Of course, I could explicitly list ConfigCache for preloading - but this doesn't work in the
generic case as it requires ad-hoc knowledge of the codebase.
------------------------------------------------------------------------
[2020-03-05 11:03:19] nikic@php.net
Can you please share the relevant code in Symfony?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=79349
--
Edit this bug report at https://bugs.php.net/bug.php?id=79349&edit=1
Thread (9 messages)