#49938 closed defect (bug) (fixed)
Deprecate wp_unregister_GLOBALS()
Reported by: | desrosj | Owned by: | desrosj |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bootstrap/Load | Keywords: | has-patch early has-dev-note |
Focuses: | Cc: |
Description
register_globals
was deprecated in PHP 5.3.0 and removed in 5.4.0. Since Core now supports PHP >= 5.6.20, this can probably be deprecated.
The first line of wp_unregister_GLOBALS()
checks if ( ! ini_get( 'register_globals' ) )
and returns early. ini_get()
returns false
if the option is not set, so this function is probably dead code.
Attachments (1)
Change History (12)
#2
@
4 years ago
If a user-land ini_set()
call tries to set a PHP configuration value that's not recognized (which the case for register_globals
), its value will not "stick".
For example:
var_dump(ini_set('register_globals', 'on'));
var_dump(ini_get('register_globals'));
Both of these will return false because register_globals
is not registered as a value.
@
4 years 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.
This ticket was mentioned in PR #229 on WordPress/wordpress-develop by desrosj.
4 years ago
#4
Trac ticket: https://core.trac.wordpress.org/ticket/49938
#5
@
4 years ago
- Keywords early added
Thanks for confirming @ayeshrajans! You beat me to testing. I created a PR to ensure the build passes (which it does). I am also marking this early
. While it does not appear there would be any consequences of deprecating this function, I'd rather land it early because it affects the loading process just in case.
4 years ago
#9
This was merged into core in https://core.trac.wordpress.org/changeset/47612.
#10
@
4 years ago
- Keywords needs-dev-note added; commit removed
Going to note this in a PHP improvements dev note.
#11
@
4 years ago
- Keywords has-dev-note added; needs-dev-note removed
Referenced in the following dev note: https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/.
What's not clear to me is whether an .ini configuration will apply if PHP does not support the option. If it does, then deprecating will be more difficult. However, this is something that has not been supported for some time, and modifying Super globals should be discouraged.