Author: steph3n
Description:
Mediawiki 1.8.2 on Ubuntu Server 6.10 running Apache/2.0.55 (Ubuntu) with
PHP/5.1.6 and PostgreSQL 8.1.4.
Feeds generated from index.php/Special:Recentchanges?feed=<feed> contain errors
in the output:
Notice: Undefined offset: -2 in /var/www/languages/Language.php on line 354
I believe this is due to date incompatibilities between PostgreSQL and MySQL,
which the wiki code isn't checking for.
This doesn't affect atom and rss feeds as the feed readers ignore the errors,
but the custom binary feed output I have written is affected by this.
Steps to reproduce:
- Install mediawiki-1.8.2 on Apache2/PHP5/PostgreSQL8.1.
- Make changes to some wiki pages to generate diffs in recentchanges.
- View source of Special:Recentchanges?feed=[atom|rss]
This error only occurs when diffs are formatted into feeds.
I have tracked the bug down to include/SpecialRecentChanges:408 where
"SpecialRecentChanges::rcFormatDiff()" is called. The parameter passed is a row
from the database containing a timestamp in the format: "YYYY-MM-DD HH:mm:ssTZ"
when the expected format is "YYYYMMDDHHmmss".
The date used by a call to Language::dateandtime from
SpecialRecentChanges::rcFormatDiffRow, which results in errors being printed to
stdout.
I have fixed this bug in my own wiki by adding the line:
$obj->rc_timestamp = wfTimestamp(TS_MW, $obj->rc_timestamp);
to SpecialRecentChanges line 406.
This change reformats the timestamp to the format that the Language class
expects, and results in clean feed output. I'm not sure that this is the correct
place to fix the output, could a developer please verify this bug, and my solution.
Version: 1.9.x
Severity: normal