From 8a074052c51a1604da82716d5cdb15ee710a6b04 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 3 May 2023 15:44:39 +0000 Subject: [PATCH] General: Restore `strpos()` check in `wp-admin/load-styles.php`. This resolves a fatal error on PHP < 8.0, as `wp-includes/compat.php` is not loaded in this file, so `str_starts_with()` may not be available. Follow-up to [55703]. Props dd32, flixos90, DigTek. Fixes #58244. See #58012. git-svn-id: https://develop.svn.wordpress.org/trunk@55710 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/load-styles.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/load-styles.php b/src/wp-admin/load-styles.php index d75cfbe8d8..eb05554de2 100644 --- a/src/wp-admin/load-styles.php +++ b/src/wp-admin/load-styles.php @@ -73,7 +73,8 @@ foreach ( $load as $handle ) { $content = get_file( $path ) . "\n"; - if ( str_starts_with( $style->src, '/' . WPINC . '/css/' ) ) { + // str_starts_with() is not used here, as wp-includes/compat.php is not loaded in this file. + if ( 0 === strpos( $style->src, '/' . WPINC . '/css/' ) ) { $content = str_replace( '../images/', '../' . WPINC . '/images/', $content ); $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content ); $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );