WordPress.org

Make WordPress Core

Ticket #49938: 49938-1.patch

File 49938-1.patch, 2.2 KB (added by ayeshrajans, 20 months ago)

Attaching a atch that removes the call to this function, moves it the deprecated functions file, and emits a deprecation notice. It also removes the dead code that would never run in PHP versions beyond PHP 5.4.

  • src/wp-includes/deprecated.php

    diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
    index f4e50a2a1c..6c9e5f6fcf 100644
    a b function wp_make_content_images_responsive( $content ) { 
    39833983        // This will also add the `loading` attribute to `img` tags, if enabled.
    39843984        return wp_filter_content_tags( $content );
    39853985}
     3986
     3987/**
     3988 * Turn register globals off.
     3989 *
     3990 * @since 2.1.0
     3991 * @access private
     3992 * @deprecated 5.5.0
     3993 */
     3994function wp_unregister_GLOBALS() {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
     3995        // register_globals is removed from PHP 5.4 and is no longer functional.
     3996        _deprecated_function( __FUNCTION__, '5.5.0' );
     3997}
  • src/wp-includes/load.php

    diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
    index b890e4e9ac..897f5842e1 100644
    a b function wp_get_server_protocol() { 
    2020        return $protocol;
    2121}
    2222
    23 /**
    24  * Turn register globals off.
    25  *
    26  * @since 2.1.0
    27  * @access private
    28  */
    29 function wp_unregister_GLOBALS() {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    30         if ( ! ini_get( 'register_globals' ) ) {
    31                 return;
    32         }
    33 
    34         if ( isset( $_REQUEST['GLOBALS'] ) ) {
    35                 die( 'GLOBALS overwrite attempt detected' );
    36         }
    37 
    38         // Variables that shouldn't be unset.
    39         $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
    40 
    41         $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
    42         foreach ( $input as $k => $v ) {
    43                 if ( ! in_array( $k, $no_unset, true ) && isset( $GLOBALS[ $k ] ) ) {
    44                         unset( $GLOBALS[ $k ] );
    45                 }
    46         }
    47 }
    48 
    4923/**
    5024 * Fix `$_SERVER` variables for various setups.
    5125 *
  • src/wp-settings.php

    diff --git a/src/wp-settings.php b/src/wp-settings.php
    index 77bfeced23..1a5f296733 100644
    a b  
    6767// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
    6868date_default_timezone_set( 'UTC' );
    6969
    70 // Turn register_globals off.
    71 wp_unregister_GLOBALS();
    72 
    7370// Standardize $_SERVER variables across setups.
    7471wp_fix_server_vars();
    7572