Re: JSON unicode escape issue and new constants
| From: | Christoph Becker | Date: | Sun, 07 Jun 2015 19:55:31 +0000 |
| Subject: | Re: JSON unicode escape issue and new constants | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86507@lists.php.net to get a copy of this message | ||
Jakub Zelenka wrote:
> On Thu, May 28, 2015 at 7:53 PM, Jakub Zelenka <bukka@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?
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.
--
Christoph M. Becker