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