[wp-trac] [WordPress Trac] #3528: HTTP 304 status not sent correctly on PHP 5.2, breaking conditional GET on feeds

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 5 19:17:51 GMT 2007


#3528: HTTP 304 status not sent correctly on PHP 5.2, breaking conditional GET on
feeds
---------------------+------------------------------------------------------
 Reporter:  kelson   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  high     |   Milestone:  2.0.7    
Component:  General  |     Version:           
 Severity:  major    |    Keywords:           
---------------------+------------------------------------------------------
 After upgrading to WordPress 2.0.6, I noticed that my feeds were no longer
 working.  In several browsers and readers, including Firefox, IE7,
 Konqueror and Akregator, only blank files were being sent.  Server logs
 indicated a 200 response with a few hundred bytes, but browsers showed
 only an empty file.  Oddly, Opera, Dillo, and command-line GET displayed
 the files fine.

 Looking at the actual HTTP response headers, it turned out that on
 conditional GETs that were supposed to issue 304 Not Modified, the server
 was actually issuing the following:

 HTTP/1.1 200 OK
 (other headers)
 Status: 304 Not Modified

 This resulted in a 200 OK status and empty response body.

 I looked through and found that the status was being set in wp-
 includes/functions.php, in the status_header function.  I changed the
 following line:
    @header("Status: $header $text");
 to this:
    @header("Status: $header $text", TRUE, $header);

 After making that change, status headers were sent correctly.  Once I
 cleared the browser cache, feeds started loading again.

 Going by the recommended method in the PHP manual, I also tried commenting
 out the if statement regarding the PHP API, so that only the following
 statement would run:
    @header("HTTP/1.1 $header $text");

 This also worked correctly.

 This is with PHP 5.2.0 on Apache 1.3.37 (yes, I do intend to upgrade it
 eventually) using the mod_php interface.

 Write-up at http://www.hyperborea.org/journal/archives/2007/01/05/feed-
 problems/

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3528>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list