Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64050 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33638 invoked from network); 26 Nov 2012 12:35:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 12:35:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:54813] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/45-26957-BF163B05 for ; Mon, 26 Nov 2012 07:35:08 -0500 Received: by mail-lb0-f170.google.com with SMTP id j14so8809805lbo.29 for ; Mon, 26 Nov 2012 04:35:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=JJtjl+8Mr+CCQdF0vhFF5Fn1r1V8b8EP/b0gvNqDzp4=; b=yK9SEdS3HF+0Sc85TowEuFhlymwxB1fDwn1ijxgimnUBQjNaNdxZaCS6MVVXlvOb8x KApCkI7e+DXC1Q+OT7TcA1nNKNp+aTisVQUyS8aO0WqTWy0+mqxCJ9Jsz5zy9eT/Foaa zZGUeIUoPhkGGhkKfHCIYNjELtDFcz8x/1F70CAi3jcweMiNmaxNjL5+vdg7JTHy1cDr vVlEmFG5f8Egp7uVDDoV2KYWPm5OPlx6j6VGl1P1qRHaC5Ci0jtKPM3becRWBwuG8dw/ ea3S4ZMjnLVi3mJnJLOTJCW/EhRzqPo//NXQYYHm8TVaGJBPli8ST7g5KOlCfTN8BWjL ip8Q== Received: by 10.152.110.42 with SMTP id hx10mr11007645lab.0.1353933304632; Mon, 26 Nov 2012 04:35:04 -0800 (PST) Received: from debian-nnefedov.local ([46.38.35.218]) by mx.google.com with ESMTPS id b4sm5604994lbi.0.2012.11.26.04.35.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 04:35:03 -0800 (PST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "internals@lists.php.net" References: <50B34D21.4080109@hoa-project.net> Date: Mon, 26 Nov 2012 16:36:30 +0400 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <50B34D21.4080109@hoa-project.net> User-Agent: Opera Mail/12.11 (Linux) Subject: Re: [PHP-DEV] DateTime::modify('now') is ignored, why? From: inefedor@gmail.com ("Nikita Nefedov") On Mon, 26 Nov 2012 15:06:09 +0400, Ivan Enderlin @ Hoa = wrote: > Hi internals, > > I would to modify a \DateTime object to the current time, thus I wrote= = > this: > > $d =3D new \DateTime('+1 hour'); > $d->modify('now'); > > It did not work. Why? Because the documentation = > (http://php.net/datetime.formats.relative) says: =E2=80=9CNow - this i= s simply = > ignored=E2=80=9D. Really? But the behavior is pretty straightforward i= sn't? = > =E2=80=9Cmodify to now=E2=80=9D means =E2=80=9Cset to the current date= and time and let the = > timezone unchanged=E2=80=9D. > > Thoughts? > Best regards. > Shouldn't DateTime be immutable? What's the point of DateTime object bei= ng = mutable? I would include my point about why DateTime should be immutable but I ev= en = can't come with any points except OO-logic and all I can say is I just = feel like mutable DateTime is wrong. What you think about it? PS I'm not Nikita Popov (aka nikic) :)