Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#9035 closed defect (bug) (fixed)

304 Not Modified bug introduced by [10408]

Reported by: tellyworth's profile tellyworth Owned by: westi's profile westi
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: Feeds Keywords:
Focuses: Cc:

Description

[10408] changes the behaviour of mysql2date(), in a way that can cause WP::send_headers() to incorrectly produce a 304 Not Modified response to an unconditional GET for feeds.

When the locale is something other than English, this line of code in send_headers() gets a non-English date:

http://trac.wordpress.org/browser/trunk/wp-includes/classes.php#L330

$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';

That causes $wp_modified_timestamp to be false, which in turn causes the conditional block below to be true and return a 304 response instead of a 200.

Net result is broken feeds for non-en users.

Two things should be fixed imho:

  • either mysql2date() returns to its previous behaviour, or send_headers() is changed to use a different function to format $wp_last_modified. I'm not sure that mysql2date is appropriate in this context, when an English-only GMT date is required.
  • the conditional block at the bottom of send_headers() should include a defensive check so that a 304 response is never produced unless either IF_MODIFIED_SINCE or IF_NONE_MATCH are set.

Change History (4)

#1 @lloydbudd
17 years ago

  • Version set to 2.7

#2 @lloydbudd
17 years ago

  • Version changed from 2.7 to 2.8

#3 @westi
17 years ago

  • Component changed from General to Feeds
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Hmm, we lost the $translate functionality on mysql2date so it always translates now.

My bad I missed that when committing.

We just need to add that back into mysql2date

Something like:

if ( $translate)
    return date_i18n( $dateformatstring, $i );
else
    return date( $dateformatstring, $i );

Instead of:

    return date_i18n( $dateformatstring, $i );

#4 @westi
17 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10504]) Respect the translation argument of mysql2date again. Fixes #9035 and #8989.

Note: See TracTickets for help on using tickets.