From 282c813259cd1bebc103f51a60d5f5a72c727e7e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 12 Sep 2020 00:12:08 +0000 Subject: [PATCH] Coding Standards: Explicitly declare the `$wp_version` global used in some core files. Props jaydeep-rami, sabernhardt. Fixes #44932. Built from https://develop.svn.wordpress.org/trunk@48971 git-svn-id: http://core.svn.wordpress.org/trunk@48733 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-plugin-upgrader.php | 5 +++-- wp-admin/includes/class-theme-upgrader.php | 5 +++-- wp-includes/default-constants.php | 6 +++--- wp-includes/version.php | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php index 27dc757f19..c750399277 100644 --- a/wp-admin/includes/class-plugin-upgrader.php +++ b/wp-admin/includes/class-plugin-upgrader.php @@ -406,13 +406,14 @@ class Plugin_Upgrader extends WP_Upgrader { * @since 3.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. * * @param string $source The path to the downloaded package source. * @return string|WP_Error The source as passed, or a WP_Error object * if no plugins were found. */ public function check_package( $source ) { - global $wp_filesystem; + global $wp_filesystem, $wp_version; $this->new_plugin_data = array(); @@ -459,7 +460,7 @@ class Plugin_Upgrader extends WP_Upgrader { $error = sprintf( /* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */ __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), - $GLOBALS['wp_version'], + $wp_version, $requires_wp ); diff --git a/wp-admin/includes/class-theme-upgrader.php b/wp-admin/includes/class-theme-upgrader.php index c08d3c2d5c..3c8f2d9abf 100644 --- a/wp-admin/includes/class-theme-upgrader.php +++ b/wp-admin/includes/class-theme-upgrader.php @@ -519,12 +519,13 @@ class Theme_Upgrader extends WP_Upgrader { * @since 3.3.0 * * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. * * @param string $source The full path to the package source. * @return string|WP_Error The source or a WP_Error. */ public function check_package( $source ) { - global $wp_filesystem; + global $wp_filesystem, $wp_version; $this->new_theme_data = array(); @@ -606,7 +607,7 @@ class Theme_Upgrader extends WP_Upgrader { $error = sprintf( /* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */ __( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ), - $GLOBALS['wp_version'], + $wp_version, $requires_wp ); diff --git a/wp-includes/default-constants.php b/wp-includes/default-constants.php index 77f76319b8..bb57b96536 100644 --- a/wp-includes/default-constants.php +++ b/wp-includes/default-constants.php @@ -16,7 +16,7 @@ * @global string $wp_version The WordPress version string. */ function wp_initial_constants() { - global $blog_id; + global $blog_id, $wp_version; /**#@+ * Constants for expressing human-readable data sizes in their respective number of bytes. @@ -99,8 +99,8 @@ function wp_initial_constants() { // Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified, // non-concatenated scripts and stylesheets. if ( ! defined( 'SCRIPT_DEBUG' ) ) { - if ( ! empty( $GLOBALS['wp_version'] ) ) { - $develop_src = false !== strpos( $GLOBALS['wp_version'], '-src' ); + if ( ! empty( $wp_version ) ) { + $develop_src = false !== strpos( $wp_version, '-src' ); } else { $develop_src = false; } diff --git a/wp-includes/version.php b/wp-includes/version.php index d7117ad360..079721ada3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-48970'; +$wp_version = '5.6-alpha-48971'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.