From e4d4ef8f0edc29013e3ac4600eefebc05ad8bec1 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 22 Aug 2023 12:47:25 +0000 Subject: [PATCH] General: Revert the last use of `str_starts_with()` in `update-core.php`. Fixes updating WordPress from 5.7 and earlier versions. When doing the update this file runs first in the old version where the polifills may not be available. Props frankit, azaozz. Reviewed by audrasjb. Merges [56417] to the 6.3 branch. Fixes #59145. Built from https://develop.svn.wordpress.org/branches/6.3@56425 git-svn-id: http://core.svn.wordpress.org/branches/6.3@55937 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/update-core.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 8d672199ee..6085b02c8f 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -1431,9 +1431,13 @@ function update_core( $from, $to ) { } else { $lang_dir = WP_CONTENT_DIR . '/languages'; } - + /* + * Note: str_starts_with() is not used here, as this file is included + * when updating from older WordPress versions, in which case + * the polyfills from wp-includes/compat.php may not be available. + */ // Check if the language directory exists first. - if ( ! @is_dir( $lang_dir ) && str_starts_with( $lang_dir, ABSPATH ) ) { + if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) { // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. $wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR ); clearstatcache(); // For FTP, need to clear the stat cache. diff --git a/wp-includes/version.php b/wp-includes/version.php index 8043cb54eb..a06a911f19 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3.1-alpha-56423'; +$wp_version = '6.3.1-alpha-56425'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.