Edit report at http://bugs.php.net/bug.php?id=52172&edit=1
ID: 52172 Updated by: [email protected] Reported by: harald dot lapp at gmail dot com Summary: Impossible to escape escape character -Status: Open +Status: Bogus Type: Bug Package: JSON related Operating System: * PHP Version: 5.3.2 New Comment: You are confusing PHP escapes and json escapes. Watch: php > $str = '["\\"]'; php > echo $str; ["\"] That's obviously not valid json. What you actually want: php > $str = '["\\\\"]'; php > echo $str; ["\\"] php > var_dump(json_decode($str)); array(1) { [0]=> string(1) "\" } Works fine. No bug here. Previous Comments: ------------------------------------------------------------------------ [2010-06-24 16:35:06] harald dot lapp at gmail dot com Description: ------------ Apparently it's impossible to decode strings with escaped "escape" character: \\ this should work however, as it's written in the json specs on http://json.org/ Test script: --------------- <?php var_dump(json_decode('["\\"]', true)); ?> Expected result: ---------------- array(1) { [0]=> string(1) "\" } Actual result: -------------- NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52172&edit=1
