WordPress.org

Make WordPress Core

Ticket #48605: 48605.patch

File 48605.patch, 1.2 KB (added by jrf, 14 months ago)

Fix type change for REQUEST_TIME and REQUEST_TIME_FLOAT

  • src/wp-includes/load.php

    From 7f86e4825bc4b2dea370fdceebf11b27237dabcc Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Fri, 22 Nov 2019 00:54:24 +0100
    Subject: [PATCH] Load: $_SERVER['REQUEST_TIME'] should always be an integer
    
    ... and $_SERVER['REQUEST_TIME_FLOAT'] should always be a float.
    ---
     src/wp-includes/load.php | 12 ++++++++++++
     1 file changed, 12 insertions(+)
    
    diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
    index d8e80fb178..d831d79271 100644
    a b function wp_magic_quotes() { 
    928928        $_COOKIE = add_magic_quotes( $_COOKIE );
    929929        $_SERVER = add_magic_quotes( $_SERVER );
    930930
     931        /*
     932         * Revert the type change to string of two indexes which should retain their proper type.
     933         * Amongst other things, this preserves compatibility of WP with PHPUnit Code Coverage generation.
     934         */
     935        if ( isset( $_SERVER['REQUEST_TIME'] ) ) {
     936                $_SERVER['REQUEST_TIME'] = (int) $_SERVER['REQUEST_TIME'];
     937        }
     938
     939        if ( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ) {
     940                $_SERVER['REQUEST_TIME_FLOAT'] = (float) $_SERVER['REQUEST_TIME_FLOAT'];
     941        }
     942
    931943        // Force REQUEST to be GET + POST.
    932944        $_REQUEST = array_merge( $_GET, $_POST );
    933945}