Bug #53067 [Opn]: DateTime::add && DateTime::sub changes original dateTime object
| From: | bogunov at gmail dot com | Date: | Thu, 14 Oct 2010 13:32:53 +0000 |
| Subject: | Bug #53067 [Opn]: DateTime::add && DateTime::sub changes original dateTime object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-155175@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53067&edit=1
ID: 53067
User updated by: bogunov at gmail dot com
Reported by: bogunov at gmail dot com
Summary: DateTime::add && DateTime::sub changes original
dateTime object
Status: Open
Type: Bug
Package: Date/time related
Operating System: Windows
-PHP Version: 5.3.3
+PHP Version: 5.3.2
Block user comment: N
New Comment:
5.3.2 version instead of 5.3.3 as selected first time
Previous Comments:
------------------------------------------------------------------------
[2010-10-14 15:31:39] bogunov at gmail dot com
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 this bug report at http://bugs.php.net/bug.php?id=53067&edit=1