Bootstrap/Load: In `wp_magic_quotes()`, revert the type change to string for `REQUEST_TIME` and `REQUEST_TIME_FLOAT` values, which should retain their proper type.

Among other things, this preserves compatibility of WP with PHPUnit Code Coverage generation.

Props jrf, Veraxus, Rarst.
See #48605.

git-svn-id: https://develop.svn.wordpress.org/trunk@47370 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-02-25 18:31:33 +00:00
parent 8dbe048737
commit 97d43fbff5
1 changed files with 12 additions and 0 deletions

View File

@ -929,6 +929,18 @@ function wp_magic_quotes() {
$_COOKIE = add_magic_quotes( $_COOKIE );
$_SERVER = add_magic_quotes( $_SERVER );
/*
* Revert the type change to string for two indexes which should retain their proper type.
* Among other things, this preserves compatibility of WP with PHPUnit Code Coverage generation.
*/
if ( isset( $_SERVER['REQUEST_TIME'] ) ) {
$_SERVER['REQUEST_TIME'] = (int) $_SERVER['REQUEST_TIME'];
}
if ( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ) {
$_SERVER['REQUEST_TIME_FLOAT'] = (float) $_SERVER['REQUEST_TIME_FLOAT'];
}
// Force REQUEST to be GET + POST.
$_REQUEST = array_merge( $_GET, $_POST );
}