On Sun, Jun 7, 2015 at 8:55 PM, Christoph Becker <cmbecke...@gmx.de> wrote:

> Jakub Zelenka wrote:
>
> > On Thu, May 28, 2015 at 7:53 PM, Jakub Zelenka <bu...@php.net> 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

Reply via email to