From:             phreaks at gmail dot com
Operating system: Linux
PHP version:      5.2.5
PHP Bug Type:     Date/time related
Bug description:  Handling of adding days to date incorrect

Description:
------------
When adding days to a date returns wrong weekday.
This only happens when adding days to 12-31-07.
Workaround is handle any new year dates by starting from 1-1-08 and adding
days.

Reproduce code:
---------------
$fm = 12;
$day = 31;

for ($i = 0; $i < 7; $i++)
 echo date("M-d (w)", mktime(1,1,1,$fm,$day++))."<BR>";

Expected result:
----------------
Expected output
Dec-31 (1)
Jan-01 (2)
Jan-02 (3)
Jan-03 (4)
Jan-04 (5)
Jan-05 (6)
Jan-06 (0)

Actual result:
--------------
The output of above is:
Dec-31 (3)
Jan-01 (4)
Jan-02 (5)
Jan-03 (6)
Jan-04 (0)
Jan-05 (1)
Jan-06 (2)


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

Reply via email to