Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78677 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15789 invoked from network); 4 Nov 2014 20:06:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2014 20:06:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.181 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.181 mail-ig0-f181.google.com Received: from [209.85.213.181] ([209.85.213.181:56938] helo=mail-ig0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/22-02095-FB139545 for ; Tue, 04 Nov 2014 15:06:24 -0500 Received: by mail-ig0-f181.google.com with SMTP id l13so81930iga.8 for ; Tue, 04 Nov 2014 12:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=FvljWTZO0uA8gNMpg3wbpuujdu+NdxVJvqwq6gHPM2g=; b=HCbxTSO0fWmdUcIHND7m14ViD9cNccgffyb3ljP7tuj9aI2b8VrAwjPGTwdO+D+4gi lTRfYH4Dvgy7ENwiWg3Z93zsIHc75TMJXFo2iXiJ7fPHFSNo22Rimw1WplQeLevcJL15 IP+/6CgGfxAgLgAFWXV6c81Yq6FUGbkMDP8GF9DJK6Qxpp7oEDHuyzkcf8ENDLfsTo3v ZW8jlCupi/ggIyeTwTjd+kjnoKMsKrb9wbSjjoroyDTZsORxvPVQR0/JMwquSKSMoK+o AtCXxLkdCe34w+QvQLD/QxjUV7OOgPnAONo9kjDEf5vqHXxpojziaO113yMkmGb8EDWL 54oA== MIME-Version: 1.0 X-Received: by 10.42.100.14 with SMTP id y14mr221633icn.64.1415131580865; Tue, 04 Nov 2014 12:06:20 -0800 (PST) Sender: jakub.php@gmail.com Received: by 10.107.11.217 with HTTP; Tue, 4 Nov 2014 12:06:20 -0800 (PST) In-Reply-To: <76457381-6DBD-4C20-B18F-7CFB9D2EC55A@ajf.me> References: <76457381-6DBD-4C20-B18F-7CFB9D2EC55A@ajf.me> Date: Tue, 4 Nov 2014 20:06:20 +0000 X-Google-Sender-Auth: WbhgBisG_R9k3__GLMTOKfwMXJU Message-ID: To: Andrea Faulds Cc: Ferenc Kovacs , Juan Basso , PHP Internals Content-Type: multipart/alternative; boundary=90e6ba6147b8302a1705070dffd7 Subject: Re: [PHP-DEV] Add a new flag for json_encode From: bukka@php.net (Jakub Zelenka) --90e6ba6147b8302a1705070dffd7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, On Tue, Nov 4, 2014 at 6:14 PM, Andrea Faulds wrote: > > > On 4 Nov 2014, at 17:07, Jakub Zelenka wrote: > > > > I would really like to see it as default in the next major as it is a > > useful feature. > > > > However I don't like adding new flag. The reason for that is that it > > becomes useless after 7 is realesed. It would be useful only for >5.6.3 > and > > <7.0 though. The only use case in PHP 7 would be just to disable the fl= ag > > but that won't be very nice and completely different than other json > > constant usage It means doing something like $options & > > ~JSON_PRESERVE_FRACTIONAL_PART ... It's a bit messy IMHO. Think that it > > would be much better to wait till 7 with this feature. > > I really don=E2=80=99t like the idea of making this the default. On 32-bi= t > systems, floats give you, effectively, extra integer range up until you h= it > 2^52, and indeed all JS integer values are just floats within that range.= I > don=E2=80=99t think they should be represented as floats. It=E2=80=99d go= weirdly with > 64-bit PHP, which can decode such values to integers, which would then no= t > handle the range beyond 2^52 nicely. > That's a good point. However I still think that there are more advantages for making this the default. I like mainly the idea that json_decode(json_encode($a)) =3D $a for all floats which is not the case at the moment. Also it allow some other things that were mentioned before. Think that we will probably need an RFC for that as we apparently don't have a consensus about this. Cheers Jakub --90e6ba6147b8302a1705070dffd7--