Make WordPress Core


Ignore:
Timestamp:
06/23/2023 12:15:06 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Database: Replace str_contains() and str_ends_with() usage in wpdb methods.

This avoids fatal errors on PHP < 8.0 if the file is included directly outside of WordPress core, e.g. by HyperDB.

While WordPress core does include polyfills for these functions, they are not directly loaded in the wpdb class.

Follow-up to [54384], [55157], [55158], [55988], [55990].

Props dd32, ryelle, joedolson.
See #58206.

File:
1 edited

Legend:

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

    r55710 r55994  
    7474    $content = get_file( $path ) . "\n";
    7575
    76     // str_starts_with() is not used here, as wp-includes/compat.php is not loaded in this file.
     76    // Note: str_starts_with() is not used here, as wp-includes/compat.php is not loaded in this file.
    7777    if ( 0 === strpos( $style->src, '/' . WPINC . '/css/' ) ) {
    7878        $content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
Note: See TracChangeset for help on using the changeset viewer.