|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67570 Immutable mean immutable, why a modify method ?
Submitted: 2014-07-04 12:06 UTC Modified: 2014-10-03 20:44 UTC
From: hello at thibaultmilan dot com Assigned:
Status: Not a bug Package: date_time (PECL)
PHP Version: 5.5.14 OS:
Private report: No CVE-ID: None
 [2014-07-04 12:06 UTC] hello at thibaultmilan dot com
From manual page:

Regarding the definition of an Immutable object ( ), I guess letting user modify an immutable it's not something we are supposed to do.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-30 15:21 UTC] capo_maxii at hotmail dot com
From manual page:
>Creates a new DateTimeImmutable object with modified timestamp. The original object is not modified.

Maybe the name of the method is ambiguous, but it doesn't modify your object, it just create a new instance with the modification made.
 [2014-07-31 09:14 UTC] hello at thibaultmilan dot com
Yes I agree with you, the name is too ambiguous.
 [2014-08-01 08:17 UTC]
Just closing this bug as it is the wrong package. It can't seem to be possible to change the category but just open a new issue (but afair there is already one about it) using the correct Date/Time category, not pecl's package.
 [2014-10-03 20:44 UTC]
-Status: Open +Status: Not a bug
 [2014-10-03 20:44 UTC]
As explained, this method doesn't actually modify the DateTimeImmutable instance and is just an artifact of DateTime and DateTimeImmutable having the same API.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 09 02:01:24 2021 UTC