-
-
Notifications
You must be signed in to change notification settings - Fork 190
ECS command fails due to deprecation in symfony console #4449
Comments
HI, What are the reproducer steps? Try removing |
Just to say they are not alone, I too have had this for a while in several projects. (running pre-released versions, on PHP 8.2 cli used at all times) updated today which gave 11.1.11 and now have this error too. However on a quick attempt to give you a reproducer, I failed - and it worked. |
@PhilETaylor How does it behave after removing |
I removed vendor and then ran a new composer update and I get the same. Just tested on other projects after a composer update and I can replicate on each project (not isolated the problem yet though) |
100% unrelated but one to watch for future too symfony/symfony#47904 |
In my project bug exists after last update, i have fresh vendor install:
Downgrading symplify/easy-coding-standard to 11.1.10 resolve issue, so last update must be related. |
@TomasVotruba reproducer below...
Gives this output:
|
actually can also be reproduced with just
|
+1. Build: https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593 PHP Fatal error: Uncaught Error: Call to undefined function ECSPrefix202210\trigger_deprecation() in /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Command/Command.php:116
Stack trace:
#0 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Command/Command.php(140): ECSPrefix2022[10](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:11)\Symfony\Component\Console\Command\Command::getDefaultName()
#1 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Command/CompleteCommand.php(49): ECSPrefix202210\Symfony\Component\Console\Command\Command->__construct()
#2 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Application.php(948): ECSPrefix202210\Symfony\Component\Console\Command\CompleteCommand->__construct()
#3 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Application.php(1093): ECSPrefix202210\Symfony\Component\Console\Application->getDefaultCommands()
#4 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Application.php(481): ECSPrefix202210\Symfony\Component\Console\Application->init()
#5 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Application.php(468): ECSPrefix202210\Symfony\Component\Console\Application->add()
#6 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/src/Console/EasyCodingStandardConsoleApplication.php(25): ECSPrefix202210\Symfony\Component\Console\Application->addCommands()
#7 [internal function]: Symplify\EasyCodingStandard\Console\EasyCodingStandardConsoleApplication->__construct()
#8 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/dependency-injection/ContainerBuilder.php(894): ReflectionClass->newInstanceArgs()
#9 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/dependency-injection/ContainerBuilder.php(490): ECSPrefix202210\Symfony\Component\DependencyInjection\ContainerBuilder->createService()
#10 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/dependency-injection/ContainerBuilder.php(441): ECSPrefix202210\Symfony\Component\DependencyInjection\ContainerBuilder->doGet()
#[11](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:12) /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/bin/ecs.php([12](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:13)8): ECSPrefix202210\Symfony\Component\DependencyInjection\ContainerBuilder->get()
#12 /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/bin/ecs(5): require('...')
#[13](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:14) /home/runner/work/laravel-wallet/laravel-wallet/vendor/bin/ecs(120): include('...')
#[14](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:15) {main}
thrown in /home/runner/work/laravel-wallet/laravel-wallet/vendor/symplify/easy-coding-standard/vendor/symfony/console/Command/Command.php on line 1[16](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:17)
Script @php vendor/bin/ecs check handling the ecs event returned with error code [25](https://github.com/bavix/laravel-wallet/actions/runs/3313988563/jobs/5472688593#step:7:26)5
Error: Process completed with exit code 255. Might help solve the problem (ECS config): https://github.com/bavix/laravel-wallet/blob/df0eb5326590f68953ea2053def859c1e743a6f5/ecs.php |
In the projects where I have this issue I do have the I dug deeper into finding out why this is happening. There are two composer autoload instances in use:
They both define an The cause of the issue is that both
The key is an md5 hash of the name of the composer package and the path to the file to require (defined in the composer.json of the package). In the So the issue is that my project's autoload files are required and the autoload files from the ECS dependencies that have the same key in that $files array are not required. |
@stefangr Thank you, this is super helpful 👍 |
@TomasVotruba FYI this not exactly a new problem, just one exacerbated by the increasing usage of Symfony's If you want to follow a long term solution I suggest you to follow humbug/php-scoper#682 |
@theofidry Thanks for reaching out. I saw your issue in Symfony for making non-global functions, and I second that 👍 Yeah, I've had similar issue with other global functions. It's a bad practise and should be avoided in general. |
Since ecs version 11.1.11, all usages of the ecs command fail with the following error:
Within the symfony console command class in the new ecs version the trigger_deprecation function is called.
This was not the case in version 11.1.10.
The text was updated successfully, but these errors were encountered: