LoginSignup
1
1

More than 5 years have passed since last update.

WordPress環境下にてPHP 7起こる「Fatal error: 'break' not in the 'loop' or 'switch' context」のようなエラーメッセージ

Posted at

PHP 7に切り替えると
「Fatal error: 'break' not in the 'loop' or 'switch' context」のようなエラーメッセージが表示される。

何故なるかというとbreakをループやswitch以外で使ったことが原因

PHP 7ではエラーになるbreak

if (…略…){
return true;
break;
}

単純に不要な「break」をコメントにすれば解決する事もあるのだが、全部が全部コメントにすれば解決ということではないので要注意。

同様に似たようなもので言うと、continueもエラーになる場合がある。

PHP7に切り替えると管理画面が表示されない、真っ白になってしまう場合があるので要検証の必要がある。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1