Skip to content
Permalink
Browse files

General: PHP 7.3 throws an `E_WARNING` when using continue to target …

…a switch.

Applying continue to a switch is equivalent to using break and quite possibly, a continue targeting a higher level control structure is actually intended.

To target the higher level control structure, a numeric argument has to be passed to continue. This fixes two cases in WordPress Core where this is currently happening.

See: php/php-src#3364
See: https://wiki.php.net/rfc/continue_on_switch_deprecation

Props jrf.
Merges [43653] to the 4.9 branch.
Fixes #44543.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43656 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
SergeyBiryukov committed Sep 24, 2018
1 parent 830632f commit b297a03020087457d1d3a6261ab798e3080433f3
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/wp-includes/pomo/plural-forms.php
  2. +1 −1 tests/phpunit/includes/utils.php
@@ -207,7 +207,7 @@ protected function parse( $str ) {
$span = strspn( $str, self::NUM_CHARS, $pos );
$output[] = array( 'value', intval( substr( $str, $pos, $span ) ) );
$pos += $span;
continue;
break;
}
throw new Exception( sprintf( 'Unknown symbol "%s"', $next ) );
@@ -440,7 +440,7 @@ function benchmark_pcre_backtracking( $pattern, $subject, $strategy ) {
case PREG_NO_ERROR:
return $i;
case PREG_BACKTRACK_LIMIT_ERROR:
continue;
break;
case PREG_RECURSION_LIMIT_ERROR:
trigger_error('PCRE recursion limit encountered before backtrack limit.');
return;

0 comments on commit b297a03

Please sign in to comment.
You can’t perform that action at this time.