Page MenuHomePhabricator

#time: function gives strange results with invalid month names (rather than erroring out)
Closed, InvalidPublic

Description

On Swedish Wikipedia someone by mistake used a Swedish month name in the date "9 juni 2011" passed to #time: parser function. Even if month names should be in English, this worked in 2011. But the mistake showed up now in 2012, when the #time: function thought this was 9 June 2012.

It seems #time accepts time formats "day month year" with an lower case 'i' added at the end of the month name, both in full and abbreviated month names, and in Roman numeral months. But for years 2000 to 2059 these dates are somehow parsed as the current year. For years before 2000 or after 2059 the years are fine. Here are some examples of results from Wikipedia (both English and Swedish):

{{#time: Y-m-d|9 juni 1999}} displays as 1999-06-09 (correct year)
{{#time: Y-m-d|9 juni 2000}} displays as 2012-06-09 (wrong year)
{{#time: Y-m-d|9 decemberi 2020}} displays as 2012-12-09 (wrong year)
{{#time: Y-m-d|10 Xi 2030}} displays as 2012-10-10 (wrong year)
{{#time: Y-m-d|10 januaryi 2059}} displays as 2012-01-10 (wrong year)
{{#time: Y-m-d|10 januaryi 2060}} displays as 2060-01-10 (correct year)

Expected results I think is "Error: invalid time".


Version: unspecified
Severity: minor

Details

Reference
bz33579

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:01 AM
bzimport added a project: ParserFunctions.
bzimport set Reference to bz33579.
bzimport added a subscriber: Unknown Object (MLST).

I now saw that it is not only the letter 'i', but also with most other letters 'a'-'z' and 'A'-'Z'. Exceptions seems to be 'j', 'I', 'J', 'V', and 'X', which results in expected invalid time errors.

Actually, I was wrong. It looks like the behavior here is actually correct, as strange as that may seem. See comments at https://bugs.php.net/bug.php?id=66018.