Bug->Doc #53067 [Opn->Fbk]: DateTime::add && DateTime::sub changes original dateTime object

From: Date: Thu, 14 Oct 2010 14:09:42 +0000
Subject: Bug->Doc #53067 [Opn->Fbk]: DateTime::add && DateTime::sub changes original dateTime object
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5220@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 Updated by: salathe@php.net Reported by: bogunov at gmail dot com Summary: DateTime::add && DateTime::sub changes original dateTime object -Status: Open +Status: Feedback -Type: Bug +Type: Documentation Problem Package: Date/time related Operating System: Windows PHP Version: 5.3.2 Block user comment: N New Comment: The documentation states that those methods return "the modified DateTime object or FALSE on failure." Could you provide a link to where the docs say that a new object is returned? Previous Comments: ------------------------------------------------------------------------ [2010-10-14 15:32:53] bogunov at gmail dot com 5.3.2 version instead of 5.3.3 as selected first time ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#5220) next »