From:             joergleu at hotmail dot com
Operating system: Windows XP, Linux Suse 8.2
PHP version:      4.3.3RC2
PHP Bug Type:     Date/time related
Bug description:  strtotime 'next' failure

Description:
------------
I found an failure in the strtotime function. When I used the function
strtotime ('next hour/day/week/...') then the result I expected was wrong
(The result is one greater).
The similiar function call strtotime('last ...') works correctly.
In PHP Version 4.2.2 (Linux) works the function correctly.

Reproduce code:
---------------
$now = mktime(12,0,0,8,1,2003);
print $now . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', $now);
print strtotime('last hour', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('last hour', $now));
print strtotime('next hour', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('next hour', $now));
print strtotime('last day', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('last day', $now));
print strtotime('next day', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('next day', $now));
print strtotime('last week', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('last week', $now));
print strtotime('next week', $now) . ', ' . strftime('%A %d. %B %Y -
%H:%M:%S', strtotime('next week', $now));

Expected result:
----------------
X-Powered-By: PHP/4.2.2
1059732000, Friday 01. August 2003 - 12:00:00
1059728400, Friday 01. August 2003 - 11:00:00
1059735600, Friday 01. August 2003 - 13:00:00
1059645600, Thursday 31. July 2003 - 12:00:00
1059818400, Saturday 02. August 2003 - 12:00:00
1059127200, Friday 25. July 2003 - 12:00:00
1060336800, Friday 08. August 2003 - 12:00:00

Actual result:
--------------
X-Powered-By: PHP/4.3.3RC2-dev
1059732000, Friday 01. August 2003 - 12:00:00
1059728400, Friday 01. August 2003 - 11:00:00
1059739200, Friday 01. August 2003 - 14:00:00
1059645600, Thursday 31. July 2003 - 12:00:00
1059904800, Sunday 03. August 2003 - 12:00:00
1059127200, Friday 25. July 2003 - 12:00:00
1060941600, Friday 15. August 2003 - 12:00:00

-- 
Edit bug report at http://bugs.php.net/?id=24927&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24927&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24927&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24927&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24927&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24927&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24927&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24927&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24927&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24927&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24927&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24927&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24927&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24927&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24927&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24927&r=gnused

Reply via email to