Bug #70697 [Opn]: json_decode fatal error instead of parse error

From: Date: Mon, 12 Oct 2015 14:42:17 +0000
Subject: Bug #70697 [Opn]: json_decode fatal error instead of parse error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196557@lists.php.net to get a copy of this message
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: here's some research what the '\0' thing used to be: http://stackoverflow.com/a/5484777/2314626 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#196557) next »