You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I tried to use the preload feature.
Symfony generates a .preload.php Kernel during cache warmup for PHP 7.4's opcache.preload. Except when actually are using PHP 7.4, then this file is not generated.
I traced it to the point that the parameter container.dumper.inline_class_loader needs to be true in order for the file to be generated. However, the current symfony skeleton (composer create-project symfony/website-skeleton my_project_name) includes this statement in the kernel: $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug); which disables that feature when you are running PHP 7.4 (unless debug is enabled which it isn't in prod).
How to reproduce composer create-project symfony/website-skeleton my_project_name cd my_project_name bin/console cache:clear -e prod
Then a srcApp_KernelProdContainer.preload.php should be there, but it isn't.
Do the same with PHP 7.3 and it works perfectly... even though it is useless as php 7.3 can't use that file.
Possible Solution
The simplest solution is to remove the condition \PHP_VERSION_ID < 70400 but there is probably a reason for that feature to be disabled in php 7.4.
Another would be to modify the the PhpDumper to generate the file even though the inline_class_loader is disabled.
I also think it is a bug that the file isn't garanteed to be there as a server expecting this file will fail to start php processes. It would be better to have an empty file than to have nothing.
Additional context
I hardcoded container.dumper.inline_class_loader to true to get the preload file to test that feature and noticed that my small application became ever so slightly slower (~15ms to ~18ms in my example form request).
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected: v4.4.4 v5.0.4
Description
I tried to use the preload feature.
Symfony generates a
.preload.php
Kernel during cache warmup for PHP 7.4'sopcache.preload
. Except when actually are using PHP 7.4, then this file is not generated.I traced it to the point that the parameter
container.dumper.inline_class_loader
needs to betrue
in order for the file to be generated. However, the current symfony skeleton (composer create-project symfony/website-skeleton my_project_name
) includes this statement in the kernel:$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
which disables that feature when you are running PHP 7.4 (unless debug is enabled which it isn't in prod).How to reproduce
composer create-project symfony/website-skeleton my_project_name
cd my_project_name
bin/console cache:clear -e prod
Then a
srcApp_KernelProdContainer.preload.php
should be there, but it isn't.Do the same with PHP 7.3 and it works perfectly... even though it is useless as php 7.3 can't use that file.
Possible Solution
The simplest solution is to remove the condition
\PHP_VERSION_ID < 70400
but there is probably a reason for that feature to be disabled in php 7.4.Another would be to modify the the PhpDumper to generate the file even though the inline_class_loader is disabled.
I also think it is a bug that the file isn't garanteed to be there as a server expecting this file will fail to start php processes. It would be better to have an empty file than to have nothing.
Additional context
I hardcoded
container.dumper.inline_class_loader
to true to get the preload file to test that feature and noticed that my small application became ever so slightly slower (~15ms to ~18ms in my example form request).The text was updated successfully, but these errors were encountered: