PHP :: Bug #32555 :: strtotime("tomorrow") can return false
| Bug #32555 | strtotime("tomorrow") can return false | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2005-04-03 09:08 UTC | Modified: | 2005-06-18 21:26 UTC |
|
||||||
| From: | stickman at gmail dot com | Assigned: | derick (profile) | |||||||
| Status: | Closed | Package: | Date/time related | |||||||
| PHP Version: | 5.0.3, 4.3.10 | OS: | FreeBSD 4.9 | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2005-04-03 09:08 UTC] stickman at gmail dot com
Description:
------------
Early morning on April 2nd, 2005 my website broke. I tracked it down to strtotime("tomorrow") returning -1 instead of the expected "tomorrow" timestamp. strtotime("today") worked fine.
Asked a friend to test strtotime("tomorrow") and it worked fine for him on his server (set to a different time).
Tested strtotime("tomorrow") on another server, also on Pacific time, and got false again.
Went to bed to deal with it in the morning and the problem had resolved itself sometime between midnight and 7am.
Reproduce code:
---------------
#Run this code on April 2nd, sometime after midnight.
echo strtotime("tomorrow");
Expected result:
----------------
1112628800 (or thereabouts)
Actual result:
--------------
-1
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2005-04-03 09:17 UTC] stickman at gmail dot com
[2005-04-03 15:58 UTC] derick@php.net
[2005-04-03 18:17 UTC] stickman at gmail dot com
[2005-04-05 22:31 UTC] derick@php.net
[2005-04-05 23:25 UTC] web-php-bugs at sklar dot com
With PHP 4.3.9, 5.0.3, and a recent CVS checkout, the following script (run in timezone US/Eastern): <?php $stamp = 1112427000; print strftime('%c',strtotime('now',$stamp)) ."\n"; print strftime('%c',strtotime('tomorrow',$stamp)) ."\n"; ?> produces: Sat Apr 2 02:30:00 2005 Sun Apr 3 03:30:00 2005 Which seems like a reasonable way for strtotime() to behave when it's called without a starting timestamp during the period that's less than 24 hours but more than 23 hours before a change to DST in a DST-respecting locale. That is, report the local time that corresponds to 86400 seconds after strtotime() is called.[2005-06-18 21:26 UTC] derick@php.net