Make WordPress Core


Ignore:
Timestamp:
06/24/2023 09:50:34 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use str_ends_with() in a few more places.

str_ends_with() was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) ends with the given substring (needle).

WordPress core includes a polyfill for str_ends_with() on PHP < 8.0 as of WordPress 5.9.

Follow-up to [55990].

See #58220.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r55990 r56014  
    878878    foreach ( $active_plugins as $plugin ) {
    879879        if ( ! validate_file( $plugin )                     // $plugin must validate as file.
    880             && '.php' === substr( $plugin, -4 )             // $plugin must end with '.php'.
     880            && str_ends_with( $plugin, '.php' )             // $plugin must end with '.php'.
    881881            && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
    882882            // Not already included as a network plugin.
Note: See TracChangeset for help on using the changeset viewer.