note 118941 deleted from function.json-decode by cmb

From: Date: Thu, 03 Mar 2016 13:22:56 +0000
Subject: note 118941 deleted from function.json-decode by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-205090@lists.php.net to get a copy of this message
Note Submitter: Kolja Nep ---- It seems that json_decode will return a Syntax Error when the JSON string has previsouly been filtered. For example: $string = '{"x":"y"'; $filteredString = filter_var($string, FILTER_SANITIZE_STRING); var_dump(json_decode($filteredString,true)); // NULL var_dump(json_last_error_msg()); // string(12) "Syntax error" var_dump(json_decode($string,true)); // array(1) { ["x"]=>string(1) "y" }

« previous php.notes (#205090) next »