From:             chet at somedec dot com
Operating system: Linux
PHP version:      5.2.4RC3
PHP Bug Type:     Date/time related
Bug description:  Quirk in strtotime using 'next' relative keyword

Description:
------------
Adding time (even zero) to a relative date using the "next" keyword fails.

Reproduce code:
---------------
<?php
    $day = date("l"); // Get what /today/ is.
    $plain = strtotime("Next $day");
    $zweek = strtotime("Next $day + 0 weeks");
    $incweek = strtotime("Next $day + 1 week");
    $zmin = strtotime("Next $day + 0 weeks");
    $incmin = strtotime("Next $day + 1 minute");
    echo "Today is $day\n";
    echo "Next $day is " . date(DATE_ATOM, $plain) . "\n";
    echo ($zweek === $plain ? "PASS\t" : "FAIL\t") . "Next $day + 0 weeks
is " . date(DATE_ATOM, $zweek) . "\n";
    echo ($incweek !== $plain ? "PASS\t" : "FAIL\t") . "Next $day + 1 week
is " . date(DATE_ATOM, $incweek) . "\n";
    echo ($zmin === $plain ? "PASS\t" : "FAIL\t") . "Next $day + 0 minutes
is " . date(DATE_ATOM, $zmin) . "\n";
    echo ($incmin == ($plain + 60) ? "PASS\t" : "FAIL\t") . "Next $day + 1
minute is " . date(DATE_ATOM, $incmin) . "\n";
?>

Expected result:
----------------
The four tests should pass; none do.

Actual result:
--------------
Using the current day (according to your computer clock) in conjunction
with the next keyword (i.e. "Next Thursday" when run on Thursday) correctly
returns one week from the current date. However, adding or subtracting any
amount of time results in an erroneous result of the /current date/ plus or
minus the offset.

-- 
Edit bug report at http://bugs.php.net/?id=42489&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42489&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42489&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42489&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42489&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42489&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42489&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42489&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42489&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42489&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42489&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42489&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42489&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42489&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42489&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42489&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42489&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42489&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42489&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42489&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42489&r=mysqlcfg

Reply via email to