Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13460 invoked from network); 11 Jan 2015 20:11:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2015 20:11:05 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.174 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.223.174 mail-ie0-f174.google.com Received: from [209.85.223.174] ([209.85.223.174:57454] helo=mail-ie0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/21-05184-5D8D2B45 for ; Sun, 11 Jan 2015 15:11:02 -0500 Received: by mail-ie0-f174.google.com with SMTP id at20so22493467iec.5 for ; Sun, 11 Jan 2015 12:10:58 -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=2bQxGe7UDCeO6icR9/QwoTGF4fv00oaZtAArWj0iX/8=; b=zO/oWxz/j4CCb0ANLFclycYkK0sYmOmi+L/ggyS68aULWt4A2CtaZ6EqyGuX0Q+MDP egm+sZJ8yJeE43L2jAjhFKppPSG0rssqzAR2Dmi0i56vcPTYefliKl6qqCKxfZCwJRPG /a4egMZxuMx64wVJHdACdh07hHJhIRri60wf+Nz4L3TnUNHiN0KfRjNByeK9DrsRDYRI EGq+VoWJEfHmoypS5IiRI13OOU6RWtZSZYIjPOmWcBEHkBEIXgka4M5KdgF4W9/BZsbm f5qOsH+rMq4r3tZzETcO+HdJyEp5qVDe4t1rJSvUj3UWPj/uTOnmtFPLBfZEUFVpjulx j0lw== MIME-Version: 1.0 X-Received: by 10.50.44.104 with SMTP id d8mr8103043igm.9.1421007058381; Sun, 11 Jan 2015 12:10:58 -0800 (PST) Sender: jakub.php@gmail.com Received: by 10.107.11.30 with HTTP; Sun, 11 Jan 2015 12:10:58 -0800 (PST) In-Reply-To: References: Date: Sun, 11 Jan 2015 20:10:58 +0000 X-Google-Sender-Auth: vXVfn0Nj_PDDgvvFl4VWVEAC1xU Message-ID: To: Paul Dragoonis Cc: PHP Internals List Content-Type: multipart/alternative; boundary=e89a8ff25238f02ff0050c65fc20 Subject: Re: [PHP-DEV] [RFC] jsond From: bukka@php.net (Jakub Zelenka) --e89a8ff25238f02ff0050c65fc20 Content-Type: text/plain; charset=UTF-8 Hi, On Sun, Jan 11, 2015 at 7:07 PM, Paul Dragoonis wrote: > > I feel if we need to make a minor BC break to get this in, then go with it > for PHP 7. > Yes, it's proposed only for PHP 7 as declared in the RFC > I do think that if it's possible for you to detect when users supply this > invalid float input that you would throw an informative exception to help > people with the transition over to PHP7. > Let's first show an example and make clear what the whole thing: http://3v4l.org/2D72Q As you can see, the first type (07, 0xff, .1 and -.1) examples are really inconsistent and give a different results if there are in the array (error) or as a scalar. This seems like an obvious bug. The type 2 is consistent. The only problem is that such number format does not conform to RFC 7159 where the number is specified in https://tools.ietf.org/html/rfc7159#section-6 : number = [ minus ] int [ frac ] [ exp ] frac = decimal-point 1*DIGIT As you can see there is required a digit after decimal point... In this case we have a non conforming parser which is not right IMHO. About the special error messages. I could add a new error codes to identify these problem. However I am not sure that the current json error codes gives a useful information that would help with migration. I plan to look on error reporting later and create a different RFC if this one gets in. I have got an already implementation for bison locations in my testing scanner and parser ( you can see some logic in https://github.com/bukka/jso/blob/master/src/jso_parser.y#L160 ) that I used as an inspiration for jsond. The idea is to provide full reporting that includes location where the error is (line and column) and possibly text sample near to the error as well deeper identification of the error. It's not just this where we can give more info about the cause of the error. There is still some work and testing that will need to be done before I propose it however. Cheers Jakub --e89a8ff25238f02ff0050c65fc20--