From a753e44d4ea2dec395c272ab3b4d31047ddd1924 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 22 Apr 2020 15:42:09 +0000 Subject: [PATCH] Bootstrap/Load: Deprecate `wp_unregister_GLOBALS()`. The `register_globals` directive in PHP was deprecated in version 5.3 and removed entirely in 5.4. Now that WordPress only supports PHP 5.6.20 and newer, the `wp_unregister_GLOBALS()` function can be deprecated. Props ayeshrajans, desrosj, SergeyBiryukov. Fixes #49938. Built from https://develop.svn.wordpress.org/trunk@47612 git-svn-id: http://core.svn.wordpress.org/trunk@47387 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/deprecated.php | 12 ++++++++++++ wp-includes/load.php | 26 -------------------------- wp-includes/version.php | 2 +- wp-settings.php | 3 --- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 12312d6449..643a0bc7f5 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -3983,3 +3983,15 @@ function wp_make_content_images_responsive( $content ) { // This will also add the `loading` attribute to `img` tags, if enabled. return wp_filter_content_tags( $content ); } + +/** + * Turn register globals off. + * + * @since 2.1.0 + * @access private + * @deprecated 5.5.0 + */ +function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid + // register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4. + _deprecated_function( __FUNCTION__, '5.5.0' ); +} diff --git a/wp-includes/load.php b/wp-includes/load.php index b890e4e9ac..897f5842e1 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -20,32 +20,6 @@ function wp_get_server_protocol() { return $protocol; } -/** - * Turn register globals off. - * - * @since 2.1.0 - * @access private - */ -function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid - if ( ! ini_get( 'register_globals' ) ) { - return; - } - - if ( isset( $_REQUEST['GLOBALS'] ) ) { - die( 'GLOBALS overwrite attempt detected' ); - } - - // Variables that shouldn't be unset. - $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' ); - - $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() ); - foreach ( $input as $k => $v ) { - if ( ! in_array( $k, $no_unset, true ) && isset( $GLOBALS[ $k ] ) ) { - unset( $GLOBALS[ $k ] ); - } - } -} - /** * Fix `$_SERVER` variables for various setups. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 3a34aed8f4..0ab37e6899 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47611'; +$wp_version = '5.5-alpha-47612'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-settings.php b/wp-settings.php index 77bfeced23..1a5f296733 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -67,9 +67,6 @@ wp_register_fatal_error_handler(); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set date_default_timezone_set( 'UTC' ); -// Turn register_globals off. -wp_unregister_GLOBALS(); - // Standardize $_SERVER variables across setups. wp_fix_server_vars();