From 7f91e2731226e6512e6244881afe745e5962a173 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 20 Feb 2021 09:56:04 +0000 Subject: [PATCH] Script Loader: Explicitly declare the `$pagenow` global in `wp_deregister_script()`. This avoids an "Undefined index" PHP notice in `wp_resource_hints()` tests when running the full test suite. Remove the unused global from `get_home_url()`. Follow-up to [25443], [38100], [38174], [50156], [50164]. Props peterwilsoncc. Fixes #52566. Built from https://develop.svn.wordpress.org/trunk@50393 git-svn-id: http://core.svn.wordpress.org/trunk@50004 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.wp-scripts.php | 6 +++++- wp-includes/link-template.php | 4 ---- wp-includes/version.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index 641da53feb..abe87a10bb 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -258,9 +258,13 @@ function wp_set_script_translations( $handle, $domain = 'default', $path = null * * @since 2.1.0 * + * @global string $pagenow + * * @param string $handle Name of the script to be removed. */ function wp_deregister_script( $handle ) { + global $pagenow; + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); /** @@ -269,7 +273,7 @@ function wp_deregister_script( $handle ) { */ $current_filter = current_filter(); if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) || - ( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter ) + ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter ) ) { $not_allowed = array( 'jquery', diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9554de3d2f..7cd756c4dd 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -3253,8 +3253,6 @@ function home_url( $path = '', $scheme = null ) { * * @since 3.0.0 * - * @global string $pagenow - * * @param int|null $blog_id Optional. Site ID. Default null (current site). * @param string $path Optional. Path relative to the home URL. Default empty. * @param string|null $scheme Optional. Scheme to give the home URL context. Accepts @@ -3262,8 +3260,6 @@ function home_url( $path = '', $scheme = null ) { * @return string Home URL link with optional path appended. */ function get_home_url( $blog_id = null, $path = '', $scheme = null ) { - global $pagenow; - $orig_scheme = $scheme; if ( empty( $blog_id ) || ! is_multisite() ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d4518322e..b52c139d92 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-beta3-50392'; +$wp_version = '5.7-beta3-50393'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.