https://bugzilla.wikimedia.org/show_bug.cgi?id=28127
Summary: wfTimestamp can take excesive amounts of time for
inputs very far in the past (aka around year 0)
Product: MediaWiki
Version: wikimedia-deployment
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Normal
Component: General/Unknown
AssignedTo: [email protected]
ReportedBy: [email protected]
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' ) );
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l