From a13d53562873f89a5dad8614c6a7bfcb8755667c Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Mon, 7 Oct 2024 21:13:16 +0000 Subject: [PATCH] General: Memoize the return value in `wp_get_wp_version()`. Cache the unmodified `$wp_version` value as a static. This retains the current behaviour during the upgrade process `$wp_version` referencing the version of WordPress being upgraded from. Follow up to [58848]. Props Cybr, debarghyabanerjee, mukesh27, costdev, SergeyBiryukov, TobiasBg, desrosj, azaozz. Fixes #61782. Built from https://develop.svn.wordpress.org/trunk@59192 git-svn-id: http://core.svn.wordpress.org/trunk@58587 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 87623c69d7..039339edb8 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -8833,7 +8833,11 @@ function clean_dirsize_cache( $path ) { * @return string The current WordPress version. */ function wp_get_wp_version() { - require ABSPATH . WPINC . '/version.php'; + static $wp_version; + + if ( ! isset( $wp_version ) ) { + require ABSPATH . WPINC . '/version.php'; + } return $wp_version; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 605401f421..9e9802c849 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-beta1-59191'; +$wp_version = '6.7-beta1-59192'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.