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
This commit is contained in:
desrosj 2020-04-22 15:42:09 +00:00
parent 427405535f
commit a753e44d4e
4 changed files with 13 additions and 30 deletions

View File

@ -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' );
}

View File

@ -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.
*

View File

@ -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.

View File

@ -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();