php.net |  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
Description:
------------
---
From manual page: http://www.php.net/datetimeimmutable.modify
---

Regarding the definition of an Immutable object ( https://en.wikipedia.org/wiki/Immutable_object ), I guess letting user modify an immutable it's not something we are supposed to do.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] pajoye@php.net
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] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-10-03 20:44 UTC] nikic@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC