Skip to content

Problem with auto-generated preload.php file for prod environment #37152

Closed
@Nidhognit

Description

@Nidhognit

Symfony version(s) affected: 5.0.*
php: 7.4.*

Description
If you enable in php.ini configuration preloading for prod environment,
opcache.preload=/app/var/cache/prod/App_Infrastructure_KernelProdContainer.preload.php opcache.preload_user=www-data
you will see the next error during composer update command:

Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Terminal' not found in /app/vendor/symfony/console/Application.php:84
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Console/Application.php(101): Symfony\Component\Console\Application->__construct('Composer', '1.10.7')
#1 phar:///usr/local/bin/composer/bin/composer(60): Composer\Console\Application->__construct()
#2 /usr/local/bin/composer(24): require('phar:///usr/loc...')
#3 {main}
  thrown in /app/vendor/symfony/console/Application.php on line 84

This error not reproduced for other environments.
If you will add Class 'Symfony\Component\Console\Terminal' to ...preload.php file, you will see another error.
I guess something wrong with ...preload.php file.

How to reproduce
I created simple project that contain only symfony code, with instruction how to reproduce it https://github.com/Nidhognit/symfony-error-example
You need to have docker-compose for it.

Additional context
Probably, this is composer error, but it happen only with symfony preload file and only for prod environment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions