Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73479 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64188 invoked from network); 29 Mar 2014 20:02:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2014 20:02:09 -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.192.51 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.192.51 mail-qg0-f51.google.com Received: from [209.85.192.51] ([209.85.192.51:44803] helo=mail-qg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/60-60833-0C627335 for ; Sat, 29 Mar 2014 15:02:08 -0500 Received: by mail-qg0-f51.google.com with SMTP id q108so2339922qgd.10 for ; Sat, 29 Mar 2014 13:02:06 -0700 (PDT) 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:content-type; bh=3JmnsB6mlLUkJ5LOAB3S9CExkdi3qwk/maxPvq81s3k=; b=lUpBGKfy6cUPcxh+9IxpgzEcGonrz192tBtAQTDAl/XUkiyzBWUap5TLeTtsQ+Dw56 2IshGz/ckhVi2UJvnydOF4Fg0vyTxQJzkrwCjlO5bzyMUNgjCuEvKcTb/oFxX0rvQiAH uc3lWkTpe7K8OzkEs9h8+YHQiWvojeaOkdJbUSMWaoDREv7/czdiLn7P7TAqOdAlXPo1 KxUtOXZDGy8SVL9Uhl1K07tVwszMJvqgGFmNXJCt3VirbiP+KsIIe9ceg64kz/STpsSp kNUgVFXSKdOorfy7ZNmfwKcKitvgVQx4YDiDN57eIxj+1TAy1UHM0dgQWd7eMvir0yzH 7PHA== MIME-Version: 1.0 X-Received: by 10.224.98.197 with SMTP id r5mr17246858qan.47.1396123326044; Sat, 29 Mar 2014 13:02:06 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.224.207.138 with HTTP; Sat, 29 Mar 2014 13:02:06 -0700 (PDT) In-Reply-To: References: Date: Sat, 29 Mar 2014 20:02:06 +0000 X-Google-Sender-Auth: yLJyAXocLu2DWCqK_mR39iny3XE Message-ID: To: PHP internals list Content-Type: multipart/alternative; boundary=089e013cba98e95dc104f5c44ab6 Subject: Re: JSON issues From: bukka@php.net (Jakub Zelenka) --089e013cba98e95dc104f5c44ab6 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Mar 29, 2014 at 7:47 PM, Jakub Zelenka wrote: > Hi, > > I found few issues with the current ext/json during jsond testing: > > 1. The surrogate pairs for escaped Unicode characters are not handled > correctly. For example JSON string "\uD811\uD811" (lead surrogate followed > by lead surrogate) is accepted by the current implementation and converted > to two ill-formatted UTF-8 characters. I would like to return NULL for such > cases and set the new last json error code. I'm already using name > JSON_ERROR_UTF16 for such case in jsond. If anyone thinks about better > name, please let me know. This is apparently a bug but its fix require a > new constant. I'm not sure about the version though. 5.6 only? > > 2. This is a valid JSON str: '{ "\u0000 key starting with zero": "value" > }' . The problem is that it won't work when converted to stdClass as > property name started with '\0' are used for mangled names. > If you pass such string to json_decode, you will get a fatal error (the > script is terminated). I would like to add a check to the JSON_Parser and > return NULL from json_decode. It will requirea a new error code (new > constant). Not sure about the name (any ideas welcomed) but it could be > something like JSON_ERROR_MANGLED_PROPERTY_NAME. If user get such error, > they can use assoc array (set second param for jsond_decode to true) and it > will work. This should go to 5.6 as it's just an improvement that adds a > new constant. > > 3. There is a small bug with number of digits when checking if it's a big > number. The minus character is not considered for negative values which > means that some really low numbers are considered as low even if they could > be converted to long. It's a quick fix which should go to 5.4+ > > Any thoughts, comments or objections? > > Jakub > > > Oops. The issue number 3 is fine. Got a bit confused as I was fixing such case in jsond but the implementation is slightly different... The result is correct on both. So the real issues are just 1. and 2. :) Thanks Jakub --089e013cba98e95dc104f5c44ab6--