Last modified: 2012-04-16 09:15:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30127, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28127 - wfTimestamp can take excesive amounts of time for inputs very far in the past (aka around year 0)
wfTimestamp can take excesive amounts of time for inputs very far in the past...
Status: RESOLVED DUPLICATE of bug 14898
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-20 01:35 UTC by Bawolff (Brian Wolff)
Modified: 2012-04-16 09:15 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bawolff (Brian Wolff) 2011-03-20 01:35:24 UTC
I was testing some code related to getting time-stamps out if image files. I was trying it with various invalid inputs. One of them was if it had a time of 0000-00-00T00:00:00 (not correct, but not insane in terms of potential invalid input in the case of unknown timestamp) but a timezone of -06:00.

The code I had tried to convert that timestamp to utc (by subtracting 6*60*60 from the TS_UNIX representation). At one point it makes a wfTimestamp(TS_EXIF, -62170005600); call. This causes a "Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/w/metadata/includes/GlobalFunctions.php on line 1925" error.

Doing a quick test from the command line I get:
$ time echo 'echo wfTimestamp(TS_EXIF, -62170005600)' | php eval.php
-0001:11:29 18:00:00


real	0m16.744s
user	0m16.609s
sys	0m0.064s



Admittedly, my code should probably check for special value of all 0's as a probable thing that could be in a file if the person didn't know the time. However at the same time, there really shouldn't be any value that could make the wfTimestamp function take 16 seconds.

For reference, the line causing the issue of wfTimestamp is:
$d = date_create( $strtime, new DateTimeZone( 'GMT' ) );
Comment 1 Niklas Laxström 2011-03-20 10:40:02 UTC
I'm pretty sure this is a dupe but I can't find the other bug right now.
Comment 2 Niklas Laxström 2011-03-20 10:45:07 UTC
Found it! Please check whether this is dupe of bug 14898.
Comment 3 Brion Vibber 2011-09-14 23:59:27 UTC
Well if it's not that exactly, it's similar-looking and is also fixed in PHP 5.3.5 as I'm testing atm. :)

*** This bug has been marked as a duplicate of bug 14898 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links