Skip to content

Commit 3528598

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@59192 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ef96fb3 commit 3528598

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/wp-includes/functions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8833,7 +8833,11 @@ function clean_dirsize_cache( $path ) {
88338833
* @return string The current WordPress version.
88348834
*/
88358835
function wp_get_wp_version() {
8836-
require ABSPATH . WPINC . '/version.php';
8836+
static $wp_version;
8837+
8838+
if ( ! isset( $wp_version ) ) {
8839+
require ABSPATH . WPINC . '/version.php';
8840+
}
88378841

88388842
return $wp_version;
88398843
}

0 commit comments

Comments
 (0)