Last modified: 2012-08-04 20:49:10 UTC
Special:Contributions crashes if a user enters a year or a month for limiting his contribution list. This bug only appears on MW installations with DBs that don't use MW-like integer timestamps, e.g. PostgreSQL.
Problem: includes/SpecialContributions.php produces in invalid timestamp in TS_MW format that is not compatible for SQL queries on DBs that use their own timestamp type.
Added a path.
Created attachment 4892 [details]
Should fix the bug. Apply to includes/SpecialContributions.php
I'm not sure if my first submission has arrived since I can't find my patch in the bug report any more.
Patch looks wrong offhand; description sounds like it simply is missing a $dbr->timestamp( $ts ) conversion.
Something seems to have gone wrong with the first submission of my patch. That's why I have resubmitted it in comment #1. Do you mean this patch looks wrong? If so, why?
The bug is not only a missing $dbr->timestamp( $ts ), but the fact that the produced timestamp is *invalid*. If you think in TS_MW, the world is simple. MySQL only has to compare integer values, no matter whether a timestamp referes to an existing date/time or not. The problem occures when you want to convert a pseudo timestamp like 20090000000000 into the TS_PG format.
Thanks for the report, I applied a modified version of your patch in r34625, and put in some year boundary checks as well. I'm surprised at how gmmktime() handles 0s, which was causing another subtle bug (fixed now, but could pop up in other places that pass a timestamp with a month or day of 0.
(In reply to comment #4)
> Thanks for the report, I applied a modified version of your patch in r34625,
> and put in some year boundary checks as well. I'm surprised at how gmmktime()
> handles 0s, which was causing another subtle bug (fixed now, but could pop up
> in other places that pass a timestamp with a month or day of 0.
Well done. We run MediaWiki on PostgreSQL for about 1/2 year and everything runs fine. So, time format conversion bugs will be rather rare. However, it took 1/2 year until some user has found this one ;-). Anyway, thanks for the bug fix which will make the next version upgrade easier for us.