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
I know that bugs happen, that's life. But I looked for a way to test my application by enabling preloading in my CI ie in CLI mode.
As explained by the PHP documentation it is useless performance-wise but it may report issues with preloading we use in production in FPM mode.
Description
We recently upgraded to API Platform 2.7 at my company and faced a similar bug to api-platform/core#5522 but with this file: https://github.com/api-platform/core/blob/2.7/src/Symfony/Validator/EventListener/ValidationExceptionListener.php
I know that this is obsolete code and we should use API Platform v3 but that's not the point here 😊
The bug happens with preloading because the call to
class_alias()
is not wrapped within an if like this fix: https://github.com/api-platform/core/pull/5523/filesI know that bugs happen, that's life. But I looked for a way to test my application by enabling preloading in my CI ie in CLI mode.
As explained by the PHP documentation it is useless performance-wise but it may report issues with preloading we use in production in FPM mode.
A simple reproducer would be
php --define opcache.preload=test.php --define opcache.enable_cli=1 test.php
It fails as expected with this message:
However, the Symfony framework prevents me from testing my application because the preloading Symfony-generated file has an early return for CLI mode. It's defined here: https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L329
So I can't test my application with preloading in the CI to make sure it will work correctly in production with preloading.
A solution would be to remove the condition in
PhpDumper
but it was added 4 years ago to address an issue: #37353A viable workaround for this issue is, if need be, moving the condition to a dedicated file which would include Symfony-generated preloading file
And better ideas are welcome too!
Example
No response
The text was updated successfully, but these errors were encountered: