Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#3896 closed defect (bug) (fixed)

Wrong indices in match array in parse_w3cdtf

Reported by: mortenf's profile mortenf Owned by:
Milestone: 2.1.3 Priority: normal
Severity: critical Version: 2.1.1
Component: General Keywords: has-patch
Focuses: Cc:

Description

In rss.php, in the function parse_w3cdtf, the date/time string to parse is matched against a regular expression, which captures parts using parantheses. The resulting array, $match, is then indexed to obtain each part, but the indices used are wrong in two cases.

Running on some versions of PHP, this leads to a warning when calling the function gmmktime:

Warning:  gmmktime() expects parameter 3 to be long, string given in ...

The warning also makes the function return 0, leading to incorrect results.

Attachments (2)

rss.diff (627 bytes) - added by mortenf 18 years ago.
test.php (553 bytes) - added by jhodgdon 18 years ago.
Test script for parsing dates

Download all attachments as: .zip

Change History (7)

@mortenf
18 years ago

#1 @mortenf
18 years ago

This issue is also present in the 2.0.x branch.

#2 @markjaquith
18 years ago

Additional milestone: 2.0.10

#3 @jhodgdon
18 years ago

I believe this patch is good.

I just did a little test program to parse a date string (which I will attach directly), and found that array item 7 has the seconds, and number 11 has the "Z" if present. The current rss.php (as of SVN revision [4718] of rss.php) definitely has the indices wrong (6 and 10 respectively), and the patch fixes it.

So I recommend installing this patch.

@jhodgdon
18 years ago

Test script for parsing dates

#4 @ryan
18 years ago

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

(In [4997]) Fix parse_w3cdtf. Props mortenf. fixes #3896

#5 @ryan
18 years ago

(In [4998]) Fix parse_w3cdtf. Props mortenf. fixes #3896

Note: See TracTickets for help on using tickets.