Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86508 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35233 invoked from network); 7 Jun 2015 20:12:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jun 2015 20:12:38 -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.213.172 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.172 mail-ig0-f172.google.com Received: from [209.85.213.172] ([209.85.213.172:34823] helo=mail-ig0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/E0-27423-5B5A4755 for ; Sun, 07 Jun 2015 16:12:37 -0400 Received: by igbzc4 with SMTP id zc4so48292882igb.0 for ; Sun, 07 Jun 2015 13:12:34 -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:cc:content-type; bh=6iO+CAt8Y2/LqT7Qpx5Jni7vBOtBANJoldpMUnoXR4s=; b=dnD03IC1cwhogOqBeLN8NeX6YkgSWuYUMQznOZBq7PCrNCJgL+PErqluEwrE0Wln/6 q11xFCRjGsSFSxPLHsiZlNIx29kEhXMCiCajw89igCyo+GoJJcTBfCulonYmqPCJmWjw ECTQ9jGDhRyBz6f2l64HhakNgo9Gy2DrrPa3215SG3mn2JpoVLBBGr/+Uv1pJJTZybmu N4eZcd69DT4SP1kJpEdmMmaJWNKNFH/iuLPS6lgB9xvXTY0KF5FNwX4doYX9O+/miLWE nsd6fnLebnZI2sZ0NgLKxx/ZWAbr9qgvtbLou2oPvB7qHw9fiYqZd9hijWfqdjdq+5N0 GTrA== MIME-Version: 1.0 X-Received: by 10.107.8.4 with SMTP id 4mr16774398ioi.38.1433707954738; Sun, 07 Jun 2015 13:12:34 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.107.153.74 with HTTP; Sun, 7 Jun 2015 13:12:34 -0700 (PDT) In-Reply-To: <5574A1B3.30708@gmx.de> References: <5574A1B3.30708@gmx.de> Date: Sun, 7 Jun 2015 21:12:34 +0100 X-Google-Sender-Auth: bnV3wFPKjLQR2dvX3e7hEfDJ0QM Message-ID: To: Christoph Becker Cc: PHP internals list Content-Type: multipart/alternative; boundary=001a113ed2fe5a9d9e0517f32584 Subject: Re: JSON unicode escape issue and new constants From: bukka@php.net (Jakub Zelenka) --001a113ed2fe5a9d9e0517f32584 Content-Type: text/plain; charset=UTF-8 On Sun, Jun 7, 2015 at 8:55 PM, Christoph Becker wrote: > Jakub Zelenka wrote: > > > On Thu, May 28, 2015 at 7:53 PM, Jakub Zelenka wrote: > > > >> There are two issues (reported bugs but not really bugs) in json_decode > >> related to \u escape. > >> > >> First one is > >> json_decode('{"\u0000": 1}'); > >> reported in https://bugs.php.net/bug.php?id=68546 > >> > >> That code result in fatal error due to using malformed property (private > >> props starting with \0). I don't think that anything parsed in > json_decode > >> should result in a fatal error. That's why I would like to introduce a > new > >> json error called JSON_ERROR_MANGLED_PROPERTY_NAME . > > > > I have just created a PR for that: > https://github.com/php/php-src/pull/1332 > > .. So if any objecting (e.g. error name), then shout now before I merge > it > > to master... > > Have you considered JSON_ERROR_INVALID_PROPERTY_NAME instead of > JSON_ERROR_MANGLED_PROPERTY_NAME, or for brevity JSON_ERROR_PROPERTY_NAME? > > JSON_ERROR_INVALID_PROPERTY_NAME might be better. The mangled was meant to show the real cause of the error but it might sound a bit strange for some. I don't really mind what the name is. So if more people is for that invalid name, then I'm happy to change it. > If the issue is considered to be a bug, it might be reasonable to > backport the fix to PHP 5.5 and 5.6. The json-0 patch, which is > attached to the ticket, would have to be modified according to the error > constant. > It's more improvement than a bug fix. It's also a very rare case so the backport is not worth it. I will add it to jsond that will have in a few months stable version that is a fully drop-in replacement (including function replacement if they exists) so if anyone really wants it, then jsond should be the choice. Cheers Jakub --001a113ed2fe5a9d9e0517f32584--