警告: “继续”目标开关等同于“中断”。您的意思是使用“继续2”吗?

我有 php7.3和 symfony2.8当我尝试用控制台创建类时,我得到这个错误:

[ Symfony 组件调试异常 ContextErrorException ]警告: “继续”瞄准开关等同于“中断”。你是想 使用“继续2”?

269580 次浏览

I've got same problem and got this error too, but in my case this error shows when i'm trying to run composer install or composer update.

and i solve this issue by running composer self-update. it works on my project.

The issue looks to me to be a backward incompatibility with PHP 7.3 for the continue keyword in Switch statements. Take a look at the "Continue Targeting Switch issues Warning" section in Backward Incompatible Changes.

I ran into the same issue with Symfony 3.3 using PHP 7.3 and downgrading to PHP 7.2 resolved the warning.

Or download composer.phar from site: "https://getcomposer.org/download/" (manual download), and use command:

php composer.phar require your/package

Windows 10 Professional

PHP 7.3.1

I ran these commands to fix the problem on my desktop

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php

I upgraded to PHP 7.3, and None of these worked for me before I used,

sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer

It's just the version dependency. PHP 7.3

and composer update worked like a charm!

Maybe your composer is outdated. Below are the steps to get rid of the error.

Note: For Windows professionals, Only Step2 and Step3 is needed and done.


Step1

Remove the composer:

sudo apt-get remove composer

Step2

Download the composer:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Step3

Run composer-setup.php file

php composer-setup.php

Step4

Finally move the composer:

sudo mv composer.phar /usr/local/bin/composer


Your composer should be updated now. To check it run command:

composer

You can remove the downloaded composer by php command

php -r "unlink('composer-setup.php');"

In my case php was upgraded from php7.2.22 to php7.3.9.

so had to downgrade cli php as composer is run on terminal

//checked php version
php -v //was 7.3.9


//changed cli version back to 7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2


//checked php version
php -v //was 7.2.22

additional info if you are using apache remember to keep both cli and apache in same version. in my case i had to downgrade

//changed web version back to 7.2
sudo a2dismod php7.3
sudo a2enmod php7.2
sudo service apache2 restart

This will work with other versions. so feel free to switch between versions. just replace the version numbers appropriately

On debian 9 php7.3 the answer above pasted below worked perfectly.


sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer

composer self-update composer install

Now, it should works

enter image description here

I had the same issue. but fixed it by downloading composer & installing it from scratch.

that seems to be an issue with php7.3, I guess.

If you have different version installed on your system then you could use this:

php7.1 /usr/bin/composer update // or wherever your composer is

it worked for me

I changed continue to continue 2 on line 1579 in shortcodeComon.php and it fixed my problem

   if(trim($custom_link[$i]) == ""){


continue;


}

Change to:

  if(trim($custom_link[$i]) == ""){


continue 2;


}


If your code cannot be updated on some reason, just change your switch ... continue to switch ... break, as in previous versions of PHP it was meant to work this way.

In order to eliminate this error, you have to fo to the wp-config file and add these lines of code

define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

after upgrading my xampp from 7.2.0 to 7.3.0 i face this issue but after unistall composer.exe and install latest composer.exe from composer.org than issue resolved

I had to upgrade doctrine/orm:

composer update doctrine/orm


Updating doctrine/orm (v2.5.13 => v2.6.6)

I think it's a version problem, you just have to uninstall the old version of composer, then do a new installation of its new version.

 apt remove composer

and follow the steps:

  1. download the composer from its official release site by making use of the following command.
 wget https://getcomposer.org/download/1.6.3/composer.phar
  1. Before you proceed with the installation, you should rename before you install and make it an executable file.
  mv composer.phar composer
  chmod +x composer
  1. Now install the package by making use the following command.
 ./composer
  1. The composer has been successfully installed now, make it access globally using the following command. for Ubuntu 16
 mv composer /usr/bin/

for Ubuntu 18

 mv composer /usr/local/bin/

@aimme's answer should be accepted!

I would extend his answer with @david-baucum's comment because his explanation is clear!

I would also extend his answer that you can run multiple PHP versions at the same time using ppa:ondrej/php.

Then you don't need to change the PHP version simple call the composer like this: /usr/bin/php7.2 /usr/local/bin/composer install

I've got the same problem when I run composer install
I solve it by doing in composer directory php composer.phar self-update and then in my project directory composer update

Sorry for the "diggy up", but i just encoured this issue with an symfony3.8 project deploiement on shared hosting (php 7.3.18)...

I solved this issue by set the php memory limit in the command line options, a stuff like this:

php -dmemory_limit=-1 /path/to/the/executable