Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57530 invoked from network); 5 Nov 2014 16:32:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 16:32:31 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:46515] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/61-50436-E115A545 for ; Wed, 05 Nov 2014 11:32:30 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id E4435240015; Wed, 5 Nov 2014 11:32:26 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o6tLgNCBH358; Wed, 5 Nov 2014 11:32:26 -0500 (EST) Received: from oa-res-26-28.wireless.abdn.ac.uk (oa-res-26-28.wireless.abdn.ac.uk [137.50.26.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 4BC182400D4; Wed, 5 Nov 2014 11:32:25 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: Date: Wed, 5 Nov 2014 16:32:23 +0000 Cc: Chris Wright , Jakub Zelenka , Ferenc Kovacs , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Juan Basso X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] Add a new flag for json_encode From: ajf@ajf.me (Andrea Faulds) > On 5 Nov 2014, at 16:23, Juan Basso wrote: >=20 > Andrea, I see your concerns about the bigint changes, but I am not = sure if > they are related. The PR just affect the encoding, not the decoding = part. Yes, I realise that. > So if some Python system encodes a JSON using the decimal part it will = be > the same of PHP encoding using this new flag. So, if you think the = decode > can cause an issue on bigint, it needs a big concern for system > interoperability on this part. Also, what I am proposing is not to = change > all integers in floats. What I am proposing with this flag is to make > floats values (PHP zval) output as float in the JSON. It doesn't = affect > anything in the PHP variables. JSON doesn=E2=80=99t have floats. It just has numbers, but unfortunately = some poorly-designed JSON parsers treat the existence of a decimal point = as significant. Again, I don=E2=80=99t see the benefit of adding .0 by = default if it=E2=80=99s an integral float value. For dealing with = poorly-written JSON parsers, there should of course be an option, but = there=E2=80=99s no good reason which I can see to make it the default. = If it=E2=80=99s the default, then it causes interoperability issues with = 32-bit and 64-bit PHP, and forwards-compatibility issues with bigints. = If it=E2=80=99s not the default, nothing changes and everything keeps = working well. -- Andrea Faulds http://ajf.me/