Bug #70697 [Opn->Dup]: json_decode fatal error instead of parse error
Edit report at https://bugs.php.net/bug.php?id=70697&edit=1
ID: 70697
Updated by: bukka@php.net
Reported by: glen at delfi dot ee
Summary: json_decode fatal error instead of parse error
-Status: Open
+Status: Duplicate
Type: Bug
Package: JSON related
PHP Version: 5.6.14
-Assigned To:
+Assigned To: bukka
Block user comment: N
Private report: N
New Comment:
This has been fixed and is part of 7.0. It's also a duplicate of https://bugs.php.net/bug.php?id=68546 as noted in
previous comment.
Previous Comments:
------------------------------------------------------------------------
[2015-10-12 14:49:39] glen at delfi dot ee
found related bug: https://bugs.php.net/bug.php?id=68546
but it does not have information in what version it was implemented
------------------------------------------------------------------------
[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)