note 17283 added to function.strtotime
| From: | bgates at microsoft dot com | Date: | Mon, 03 Dec 2001 11:03:54 +0000 |
| Subject: | note 17283 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21556@lists.php.net to get a copy of this message | ||
it seems like strtotime can "count" up to 2^31 seconds, AND (counting backwards from any
date below 2038), if the difference between 1jan1970 and the "str" (like "-16
years") remains within 2^31 bits from the start time (given to strtotime), then the "out
of bounds" checking functions correctly (that is,
strototime("-16years",mktime(1jan1970)) returns a negative value, as the docs say -- note,
however, the docs say fault returns only "-1" -- i've not found this true) HOWEVER,
go further, say, -67years from 1970, and the number of seconds backwards exceed 2^31 and strtotime
"wraps around" from 2038, counting down.
same is true for reverse. count up from any date, strtotime will return -negative (fault) value
unless the supplied offset exceeds 2^31 seconds, in which case strtotime wraps around from 1970
upwards.
i haven't tried passing exact offset of exact number of seconds (accounting for GMT offset),
but i wonder if passing just the right offset from just the right time (like "-2^31
seconds" from 1jan1970, or "+2^31 seconds" from 18feb2038 [or whatever the date is of
2^31 seconds after 1jan1970]) might force strotime into a nonexiting loop?
--
http://www.php.net/manual/en/function.strtotime.php
http://master.php.net/manage/user-notes.php?action=edit+17283
http://master.php.net/manage/user-notes.php?action=delete+17283
http://master.php.net/manage/user-notes.php?action=reject+17283