From:             vqkq7ov02 at sneakemail dot com
Operating system: Linux
PHP version:      5.2.9
PHP Bug Type:     Unknown/Other Function
Bug description:  date_modify miscalculates forward from end of month

Description:
------------
When date_modify() is given the last day of a month and asked to add one
weekday (e.g. +1 Sunday), if the last day of the month is that same
weekday, then date_modify() doesn't add a week-- it returns the same date
it was given.

This problem occurs in PHP 5.2.9.  It doesn't occur in PHP 5.2.6, which
returns the correct result.


Reproduce code:
---------------
<?php
echo "PHP Version = ", phpversion(), "\n";
$dt = new DateTime();
date_date_set($dt, 2009, 5, 31);
echo 'Before date_modify: ', $dt->format('l m/j/y'), "\n";
$action = "+1 Sunday";
date_modify($dt, $action);
echo "After date_modify ($action): ",  $dt->format('l m/j/y') , "\n",
    "Should be Sunday 6/7/09\n";
?>


Expected result:
----------------
PHP Version = 5.2.6-3ubuntu4.1
Before date_modify: Sunday 05/31/09
After date_modify (+1 Sunday): Sunday 06/7/09
Should be Sunday 6/7/09


Actual result:
--------------
PHP Version = 5.2.9-2
Before date_modify: Sunday 05/31/09
After date_modify (+1 Sunday): Sunday 05/31/09
Should be Sunday 6/7/09

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

Reply via email to