Skip to content

Commit b297a03

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
1 parent 830632f commit b297a03

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/wp-includes/pomo/plural-forms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected function parse( $str ) {
207207
$span = strspn( $str, self::NUM_CHARS, $pos );
208208
$output[] = array( 'value', intval( substr( $str, $pos, $span ) ) );
209209
$pos += $span;
210-
continue;
210+
break;
211211
}
212212

213213
throw new Exception( sprintf( 'Unknown symbol "%s"', $next ) );

tests/phpunit/includes/utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ function benchmark_pcre_backtracking( $pattern, $subject, $strategy ) {
440440
case PREG_NO_ERROR:
441441
return $i;
442442
case PREG_BACKTRACK_LIMIT_ERROR:
443-
continue;
443+
break;
444444
case PREG_RECURSION_LIMIT_ERROR:
445445
trigger_error('PCRE recursion limit encountered before backtrack limit.');
446446
return;

0 commit comments

Comments
 (0)