Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67330 invoked from network); 5 Nov 2014 17:01:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 17:01:09 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.43 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.192.43 mail-qg0-f43.google.com Received: from [209.85.192.43] ([209.85.192.43:43595] helo=mail-qg0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/73-50436-0D75A545 for ; Wed, 05 Nov 2014 12:01:06 -0500 Received: by mail-qg0-f43.google.com with SMTP id f51so12443905qge.16 for ; Wed, 05 Nov 2014 09:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8raIHzIyHS92jrAb6Lwl43gasipfnr+8BMcDquqsIwo=; b=unNweof+eZufTm7SdyHZMBFtCuyeJhRL1BJTcNnLxoem5PqoJsWozRH5YMFSTIJeSN mmLq812ojflck3Po8ADwVmLs0KZ4wdDAS1BBkzAYx01bkWQG7qfem1IZjPcJsog8SyK0 6l3Ow5kmrNh+fP6D6JbSvkLzVCYYeOlBTvv1izf8rqccJrJjL6nzP+bYHI0/6EurgeB1 NposafZzufpUpF8Yt09TacTFoUvqrvYaqcNVFf+lsWWjNTXCjCEC1mKmZ78olMMXMZAE tNXvknwjf1TasoDugg8eZD3uXJuVw6ulnax0WMMfdMUjqRHcTkFdfNhAgWDVKUeYz4RT bf4g== MIME-Version: 1.0 X-Received: by 10.224.111.201 with SMTP id t9mr9031969qap.44.1415206862262; Wed, 05 Nov 2014 09:01:02 -0800 (PST) Received: by 10.140.93.47 with HTTP; Wed, 5 Nov 2014 09:01:02 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Nov 2014 18:01:02 +0100 Message-ID: To: Jakub Zelenka Cc: Juan Basso , Chris Wright , PHP Internals Content-Type: multipart/alternative; boundary=001a11c231544f1b7705071f8671 Subject: Re: [PHP-DEV] Add a new flag for json_encode From: tyra3l@gmail.com (Ferenc Kovacs) --001a11c231544f1b7705071f8671 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Nov 5, 2014 at 5:34 PM, Jakub Zelenka wrote: > > > On Wed, Nov 5, 2014 at 4:23 PM, Juan Basso wrote: > >> >> I also prefer to use =E2=80=8Bdifferent flags if we enable by default. S= o if this >> behavior is enabled by default in 7.0 the JSON_PRESERVE_FRACTIONAL_PART >> is deprecated and a new flag is created to disable it. >> >> In resume of this thread, seems everyone if fine in having the flag JSON= _PRESERVE_FRACTIONAL_PART >> added on 5.6 and leave this flag off by default to keep the BC. The only >> discussion is enable or not this behavior in 7.0. >> > > No! If it should become default in 7.0, then it doesn't make to add a new > flag. What's the point of adding new flag to 5.6.x and then deprecate it = in > 7.0...? That's just mess IMHO. > > It makes sense only if it doesn't become default though. > > Cheers > > Jakub > > I think we should postpone the decision about changing the default value, and keep the scope about having JSON_PRESERVE_FRACTIONAL_PART as an optional setting. As far as I can see, everybody seems to be okay with that. I don't think that the possibility of changing the default settings in a future release(eg. 7.0) change anything about this option: The $options for json_encode is already a bitmask, and even if we change the default, you will still need the constant to be able to disable this behavior if you don't need it. I don't think that anybody else from the list favors this option in such depths that he/she would agree with you that we should even remove the option to opt-out from JSON_PRESERVE_FRACTIONAL_PART, for two reason: 1, for most apps/systems doesn't care if they receive 1.0 or 1, but sending out 1 instead of 1.0 makes the encoded form shorter so maybe some people would prefer to keep that more compact. 2, there is a chance that there are some exotic apps/systems which are already depending on the fact that php will/was used to send out 1 instead of 1.0, and while we can break BC in a major release, the migration for those people would be much easier if they just have to change/set some options for their json_encode calls. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a11c231544f1b7705071f8671--