Make WordPress Core

Changeset 43653 for trunk


Ignore:
Timestamp:
09/23/2018 10:49:02 PM (6 years ago)
Author:
jorbin
Message:

General: PHP7.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: https://github.com/php/php-src/pull/3364
See: https://wiki.php.net/rfc/continue_on_switch_deprecation

Props jrf.
Fixes #44543.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/plural-forms.php

    r42343 r43653  
    208208                        $output[] = array( 'value', intval( substr( $str, $pos, $span ) ) );
    209209                        $pos     += $span;
    210                         continue;
     210                        break;
    211211                    }
    212212
  • trunk/tests/phpunit/includes/utils.php

    r43571 r43653  
    499499                return $i;
    500500            case PREG_BACKTRACK_LIMIT_ERROR:
    501                 continue;
     501                break;
    502502            case PREG_RECURSION_LIMIT_ERROR:
    503503                trigger_error( 'PCRE recursion limit encountered before backtrack limit.' );
Note: See TracChangeset for help on using the changeset viewer.