Make WordPress Core

Opened 16 years ago

Last modified 13 years ago

#3528 closed defect (bug)

HTTP 304 status not sent correctly on PHP 5.2, breaking conditional GET on feeds — at Version 3

Reported by: kelson's profile kelson Owned by:
Milestone: 2.0.7 Priority: high
Severity: major Version: 2.0.6
Component: General Keywords:
Focuses: Cc:

Description (last modified by foolswisdom)

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

Change History (3)

#1 @kelson
16 years ago

  • Version set to 2.0.5

#2 @kelson
16 years ago

Since Wikiformatting wrapped the lines, let's try this again. WP 2.0.6 out of the box does this:

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

#3 @foolswisdom
16 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.