[英]Symfony 2.8 and PHP 7.4: Warning: "continue" targeting switch is equivalent to "break". Composer is at latest version
I am trying to update a symfony 2.8 application to use PHP 7.4, but when I try to clear the cache php app/console cache:clear
I get the following warning:我正在尝试更新 symfony 2.8 应用程序以使用 PHP 7.4,但是当我尝试清除缓存
php app/console cache:clear
时,我收到以下警告:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
which results in "script exited with non-zero code".这导致“脚本以非零代码退出”。 That messes up the whole automation process of Jenkins. The solutions I ran at were generally a simple composer update, but after I did this and updated composer to the latest version (currently 2.0.7), the error still persists, and I'm sure it's not a composer issue, as this warning crashes even the symfony-only
cache:clear
command.把Jenkins的整个自动化过程搞乱了。我跑的解决方案一般都是简单的composer update,但是在我这样做并将composer更新到最新版本(目前是2.0.7)之后,错误仍然存在,我是确保这不是作曲家的问题,因为这个警告甚至会导致 symfony-only
cache:clear
命令崩溃。 I was thinking about creating my own fork of symfony from this particular version branch and fixing the errors myself, but I cannot find the exact spot this continue
occurs.我正在考虑从这个特定的版本分支创建我自己的 symfony 分支并自己修复错误,但我找不到这个
continue
发生的确切位置。
How to eliminate this error, or at least how to debug the whole process, so I can fix the error myself?如何消除这个错误,或者至少如何调试整个过程,以便我自己修复错误?
Any help is appreciated.任何帮助表示赞赏。 Thanks in advance!
提前致谢!
Edit:编辑:
This is the message that is returned after running php app/console cache:clear --verbose
.这是运行
php app/console cache:clear --verbose
后返回的消息。 I don't see any sign of potential continue bug.我没有看到任何潜在的继续错误的迹象。 Does any of you see something like this?
你们有人看到这样的东西吗?
Exception trace:
() at
/var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2636
Symfony\Component\Debug\ErrorHandler->handleError() at
/var/www/html/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:169
require() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:169
Symfony\Component\Debug\DebugClassLoader->loadClass() at n/a:n/a
spl_autoload_call() at /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:160
Doctrine\ORM\EntityManager->__construct() at /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:850
Doctrine\ORM\EntityManager::create() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:1711
appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService() at /var/www/html/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ManagerRegistry.php:35
Symfony\Bridge\Doctrine\ManagerRegistry->getService() at /var/www/html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php:183
Doctrine\Common\Persistence\AbstractManagerRegistry->getManager() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:9401
appDevDebugProjectContainer->getFosUser_EntityManagerService() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:2945
appDevDebugProjectContainer->getFosUser_UserManagerService() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:9219
appDevDebugProjectContainer->getValidator_BuilderService() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:9201
appDevDebugProjectContainer->getValidatorService() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:8349
appDevDebugProjectContainer->getSonata_Adminbundle_Command_ExplainadmincommandService() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:295
Symfony\Component\DependencyInjection\Container->get() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:147
Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:112
Symfony\Bundle\FrameworkBundle\Console\Application->all() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:66
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:117
Symfony\Component\Console\Application->run() at /var/www/html/app/console:28
Symfony 2.8 is no longer supported, and it hasn't been made compatible with PHP 7.4 (as this was release after the last fixes for Symfony 2.8).不再支持 Symfony 2.8,并且它尚未与 PHP 7.4 兼容(因为这是在 Symfony 2.8 的最后修复之后发布的)。 You could check where exactly that error occurs and try to fix it (usually the full error message should contain such information), or you have to update Symfony 2.8 as well to a supported version.
您可以检查错误发生的确切位置并尝试修复它(通常完整的错误消息应该包含此类信息),或者您必须将 Symfony 2.8 也更新到受支持的版本。
Edit : after you've presented more details, I assume that you are using doctrine/orm
in v2.5.14.编辑:在您提供更多详细信息后,我假设您在 v2.5.14 中使用
doctrine/orm
。 This has been released in Dec 2017, and this was the latest version to be compatible with Symfony 2.8.这已于 2017 年 12 月发布,这是与 Symfony 2.8 兼容的最新版本。 As PHP 7.3 (in which the deprecation of
continue
with switch
was introduced ) was released in Dec 2018, it's not a surprise that such a problem has not been fixed in the ORM package.由于 PHP 7.3(其中引入了对
continue
with switch
的弃用)于 2018 年 12 月发布,因此在 ORM package 中未修复此类问题也就不足为奇了。
You should either stick to PHP 7.2, or update Symfony, Doctrine, and whatever bundles you are using to more recent ones.您应该坚持使用 PHP 7.2,或者将 Symfony、Doctrine 以及您使用的任何捆绑包更新为更新的捆绑包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.