Ticket #1323: wp-blog-header.diff

File wp-blog-header.diff, 1.4 KB (added by anonymousbugger, 7 years ago)
  • wp-blog-header.php

    old new  
    128128        @header('X-Pingback: ' . get_bloginfo('pingback_url')); 
    129129 
    130130        // Support for Conditional GET 
    131         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) $client_last_modified = $_SERVER['HTTP_IF_MODIFIED_SINCE']; 
    132         else $client_last_modified = false; 
    133131        if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); 
    134132        else $client_etag = false; 
    135133 
     134        $client_last_modified = trim($_SERVER['HTTP_IF_MODIFIED_SINCE']); 
     135        // If string is empty, return 0. If not, attempt to parse into a timestamp 
     136        $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; 
     137 
     138        // Make a timestamp for our most recent modification...  
     139        $wp_modified_timestamp = strtotime($wp_last_modified); 
     140         
    136141        if ( ($client_last_modified && $client_etag) ? 
    137                 ((strtotime($client_last_modified) >= strtotime($wp_last_modified)) && ($client_etag == $wp_etag)) : 
    138                 ((strtotime($client_last_modified) >= strtotime($wp_last_modified)) || ($client_etag == $wp_etag)) ) { 
     142                (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) : 
     143                (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) { 
    139144                if ( preg_match('/cgi/',php_sapi_name()) ) { 
    140145                        header('Status: 304 Not Modified'); 
    141146                        echo "\r\n\r\n";