Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62742 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74223 invoked from network); 3 Sep 2012 13:36:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 13:36:42 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.215.42 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:33030] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/CA-20751-662B4405 for ; Mon, 03 Sep 2012 09:36:39 -0400 Received: by lahl5 with SMTP id l5so3614454lah.29 for ; Mon, 03 Sep 2012 06:36:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=V1IpHQxpP+7WrKAVV2+w2vMdE8oZVarXZwXNMR8PkLY=; b=OI0cmfwmJwninfbzLeZCMRTojdttFaNKCoYvY6f2KCTOBHBovAdDbdCaBcBwLA0GuI 3YfziKbGb9J5CP9u0Ru81Td6db1AAeRgYQ6AkNiTszx/17Rj0mx6hf6IyITwckFLlb3n tarCeTWMqTNW/Jos7QPtxn3vXr8FaFgn8UJzIBppSbEO/r2BZivtmOSD4DOrMfivyjtz t890kGDpFpenA4hPGOqPtnNjJIhX/bULJXW9Eb1YK1VrRI5gHUo80IuHyG6G2sqjYJGB Ow+4CGHDzfog9rRqrzSnPaoP1eNPV2EeNAyfM6WQtYY+G9ERUWmx8glalKARFxg9oV+W /BGw== MIME-Version: 1.0 Received: by 10.152.104.44 with SMTP id gb12mr13963133lab.29.1346679394632; Mon, 03 Sep 2012 06:36:34 -0700 (PDT) Received: by 10.112.116.4 with HTTP; Mon, 3 Sep 2012 06:36:34 -0700 (PDT) X-Originating-IP: [178.200.247.30] In-Reply-To: References: <50435ABE.4010308@ajf.me> <50436412.7010802@ajf.me> <5043C3E9.2010105@ajf.me> <5043C5AF.3060701@ajf.me> <5043C74C.8020400@ajf.me> <5043D8C0.3020802@lsces.co.uk> <5044715E.3050504@rotorised.com> Date: Mon, 3 Sep 2012 15:36:34 +0200 Message-ID: To: Will Fitch Cc: Pierre Joye , Ryan McCue , internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d04088ef5f183d304c8cc3a39 X-Gm-Message-State: ALoCoQmL28BLydtt4yJzjudaTwjs/VFyV7hCfmclm+agW9HywbKSffNk94ZJMIzenGaIKdiLIl34 Subject: Re: [PHP-DEV] RFC for Adding __toString to DateTime From: kontakt@beberlei.de (Benjamin Eberlei) --f46d04088ef5f183d304c8cc3a39 Content-Type: text/plain; charset=ISO-8859-1 as i said above, a global option will make this feature completly unusable for libraries. For Doctrine we would really like to have __toString() for datetime primary keys (identity map), but we need a reliable stable lossless format that can never change. On Mon, Sep 3, 2012 at 2:01 PM, Will Fitch wrote: > On Mon, Sep 3, 2012 at 7:57 AM, Pierre Joye wrote: > > > hi Will, > > > > On Mon, Sep 3, 2012 at 1:51 PM, Will Fitch wrote: > > > On Mon, Sep 3, 2012 at 4:59 AM, Ryan McCue > wrote: > > > > > >> As far as I can tell, there's no standard which uses the Olson > database > > >> to specify the timezone, so we'd have to create one. > > >> > > >> What about ISO8601 with the Olson timezone suffixed? > > >> > > >> 2012-09-02T18:17:36+0100 (Europe/London) > > >> 2012-09-02T18:19:05+0100 (Africa/Niamey) > > >> > > > > > > Disagree - The ISO8601 provides a good *string* representation of the > > > object. If you want every aspect of the entire object, including the > > > properties which are also objects, serialize it. > > > > I don't think you will ever get a consensus on that. The reason is > > that this case falls in the same fall than the timezone itself (but > > per instance of an object instead of globally). > > > > I'd to suggest to force the definition of a format using the > > setStringFormat (or whatever will be the name of this function). > > __toString will then fail if no format has been set, warning and > > returns NULL (f.e.). > > > > I actually feel a static function which tracks globally would best serve > this case: > > date_default_format_set('c') > > This would prevent the need for setting it on a per instance basis - > similar to the way timezones can be set: > > date_default_timezone_set('America/Chicago') > > > > > > Cheers, > > -- > > Pierre > > > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > > > --f46d04088ef5f183d304c8cc3a39--