note 76650 added to function.json-decode

From: Date: Tue, 24 Jul 2007 20:08:17 +0000
Subject: note 76650 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-128890@lists.php.net to get a copy of this message
I've found some bugs in the implementation: json_decode() does not remove the backslashes from escape-encoded characters. The original string is not returned in this example: <?php $s = "\""; if ($s == json_decode(json_encode($s))) { print("ok"); } else { print("The original string was not returned"); } ?> Also, json_decode() does not fail gracefully on some input. For example, the following causes PHP to seg fault: <?php json_decode("\""); ?> I don't know of any work around or alternative functions. ---- Server IP: 64.71.164.2 Probable Submitter: 24.163.210.40 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/76650 Del: integrated -- https://master.php.net/note/delete/76650/integrated Del: useless -- https://master.php.net/note/delete/76650/useless Del: bad code -- https://master.php.net/note/delete/76650/bad+code Del: spam -- https://master.php.net/note/delete/76650/spam Del: non-english -- https://master.php.net/note/delete/76650/non-english Del: in docs -- https://master.php.net/note/delete/76650/in+docs Del: other reasons-- https://master.php.net/note/delete/76650 Reject -- https://master.php.net/note/reject/76650 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128890) next »