Bug #70697 [Opn]: json_decode fatal error instead of parse error
Edit report at https://bugs.php.net/bug.php?id=70697&edit=1
ID: 70697
User updated by: glen at delfi dot ee
Reported by: glen at delfi dot ee
Summary: json_decode fatal error instead of parse error
Status: Open
Type: Bug
Package: JSON related
PHP Version: 5.6.14
Block user comment: N
Private report: N
New Comment:
found related bug: https://bugs.php.net/bug.php?id=68546
but it does not have information in what version it was implemented
Previous Comments:
------------------------------------------------------------------------
[2015-10-12 14:43:43] glen at delfi dot ee
could this be changed to catchable error?
or completely removed now that Reflection solves the hack need?
------------------------------------------------------------------------
[2015-10-12 14:42:16] glen at delfi dot ee
here's some research what the '\0' thing used to be:
http://stackoverflow.com/a/5484777/2314626
------------------------------------------------------------------------
[2015-10-12 12:30:04] glen at delfi dot ee
Description:
------------
json with "\0000token" causes fatal error when decoding $assoc=true, however it passes
with $assoc=false.
it should return NULL and set json_last_error flag:
â php56 t.php
int(1)
array(1) {
["foo"]=>
array(1) {
["l"]=>
array(1) {
["uid"]=>
string(0) ""
}
}
}
PHP Fatal error: Cannot access property started with '\0' in t.php on line 4
â cat t.php
<?php
var_dump(1, json_decode('{"foo": {"\u0000l": {"uid":""}
} }', true));
var_dump(2, json_decode('{"foo": {"\u0000l": {"uid":""}
} }', false));
â
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70697&edit=1
Thread (6 messages)