WordPress.org

Make WordPress Core

Changeset 50393


Ignore:
Timestamp:
02/20/2021 09:53:48 AM (3 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.wp-scripts.php

    r49758 r50393  
    259259 * @since 2.1.0
    260260 *
     261 * @global string $pagenow
     262 *
    261263 * @param string $handle Name of the script to be removed.
    262264 */
    263265function wp_deregister_script( $handle ) {
     266    global $pagenow;
     267
    264268    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
    265269
     
    270274    $current_filter = current_filter();
    271275    if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
    272         ( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
     276        ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter )
    273277    ) {
    274278        $not_allowed = array(
  • trunk/src/wp-includes/link-template.php

    r50354 r50393  
    32543254 * @since 3.0.0
    32553255 *
    3256  * @global string $pagenow
    3257  *
    32583256 * @param int|null    $blog_id Optional. Site ID. Default null (current site).
    32593257 * @param string      $path    Optional. Path relative to the home URL. Default empty.
     
    32633261 */
    32643262function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
    3265     global $pagenow;
    3266 
    32673263    $orig_scheme = $scheme;
    32683264
Note: See TracChangeset for help on using the changeset viewer.