#49323 [Opn->Bgs]: json_decode escaped character weirdness

From: Date: Sat, 22 Aug 2009 10:11:13 +0000
Subject: #49323 [Opn->Bgs]: json_decode escaped character weirdness
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141386@lists.php.net to get a copy of this message
ID: 49323 Updated by: scottmac@php.net Reported By: paul dot wieland at port80ware dot com -Status: Open +Status: Bogus Bug Type: JSON related Operating System: Linux / OSX PHP Version: 5.3.0 New Comment: Definitely fixed in 5.3 scott-mbp:~ scott$ php /tmp/test.php string(10) "Black/Gray" string(10) "Black/Gray" Previous Comments: ------------------------------------------------------------------------ [2009-08-21 19:35:42] paul dot wieland at port80ware dot com Very sorry, the virtualhost I was using was not configured to use version 5.3.0 - it is using 5.2.1 instead So I am not sure if this is an old problem with 5.2.1 that has been solved, or it still exists with 5.3.0 ------------------------------------------------------------------------ [2009-08-21 19:31:12] paul dot wieland at port80ware dot com Description: ------------ json_encode is not removing the backslash from escaped forward slashes in my strings. It works fine on several machines running 5.2.x, but on one new machine running php 5.3.0 it returns the wrong result. Reproduce code: --------------- $my_string = 'Black/Gray'; var_dump($my_string); var_dump( json_decode( json_encode($my_string) ) ); Expected result: ---------------- string(10) "Black/Gray" string(10) "Black/Gray" Actual result: -------------- string(10) "Black/Gray" string(11) "Black\/Gray" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49323&edit=1

« previous php.bugs (#141386) next »