From 00f110740bb2cd75f76d12a0b83c4bc0e2776a85 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 25 Feb 2020 18:33:06 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@47370 git-svn-id: http://core.svn.wordpress.org/trunk@47157 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index b661762417..b314f63da0 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -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 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 169b10155a..8ed305a4bd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-beta2-47369'; +$wp_version = '5.4-beta2-47370'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.