From:             
Operating system: Windows
PHP version:      5.3.3
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime::add && DateTime::sub changes original dateTime object

Description:
------------
Documentation says it should return new Object thought it returns modified
old.



PHP 5.3.2 (cli) (built: Mar  3 2010 20:36:54)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Test script:
---------------
$day_interval = new DateInterval('P1D');

$cur_date = new DateTime('2000-01-02');

echo $cur_date->add($day_interval)->format('Y-m-d');

echo $cur_date->sub($day_interval)->format('Y-m-d');

Expected result:
----------------
2000-01-03

2000-01-01

Actual result:
--------------
2000-01-03

2000-01-02

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

Reply via email to