From 848e8cbaecddf4deeccdc03d397fc3cbf769b5fe Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 24 Jun 2023 13:02:23 +0000 Subject: [PATCH] General: Replace `substr_compare()` usage in the `str_ends_with()` polyfill. This avoids a warning on PHP < 7.2.18 if haystack is an empty string: {{{ Warning: substr_compare(): The start position cannot exceed initial string length }}} Follow-up to [52040], [55158], [55990], [56014]. See #58220. Built from https://develop.svn.wordpress.org/trunk@56015 git-svn-id: http://core.svn.wordpress.org/trunk@55527 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/compat.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/compat.php b/wp-includes/compat.php index f9df28eac9..38ae725e93 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -488,7 +488,7 @@ if ( ! function_exists( 'str_ends_with' ) ) { $len = strlen( $needle ); - return 0 === substr_compare( $haystack, $needle, -$len, $len ); + return $needle === substr( $haystack, -$len, $len ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index c41589188d..bd09b38b20 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-56014'; +$wp_version = '6.3-alpha-56015'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.