From:             brad at omnis dot com
Operating system: Linux (CentOS 5.3)
PHP version:      5.3.0
PHP Bug Type:     Date/time related
Bug description:  dateTime->add() doesn't properly account for days past the 
end of months

Description:
------------
dateTime->add(dateInterval) isn't applying proper calendar math when
adding intervals.

Reproduce code:
---------------
$dateTest = new dateTime('2008-01-31',new dateTimeZone("GMT"));
print_r($dateTest);

$dateTest->add(new dateInterval('P1M'));
print_r($dateTest);


Expected result:
----------------
DateTime Object
(
    [date] => 2008-01-31 00:00:00
    [timezone_type] => 3
    [timezone] => UTC
)
DateTime Object
(
    [date] => 2008-02-28 00:00:00
    [timezone_type] => 3
    [timezone] => UTC
)


Actual result:
--------------
DateTime Object
(
    [date] => 2008-01-31 00:00:00
    [timezone_type] => 3
    [timezone] => UTC
)
DateTime Object
(
    [date] => 2008-03-02 00:00:00
    [timezone_type] => 3
    [timezone] => UTC
)


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

Reply via email to