Bug #49323 [Com]: json_decode escaped character weirdness

From: Date: Thu, 25 Mar 2010 11:49:27 +0000
Subject: Bug #49323 [Com]: json_decode escaped character weirdness
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148994@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49323&edit=1 ID: 49323 Comment by: dmitry dot dulepov at gmail dot com Reported by: paul dot wieland at port80ware dot com Summary: json_decode escaped character weirdness Status: Bogus Type: Bug Package: JSON related Operating System: Linux / OSX PHP Version: 5.3.0 New Comment: No, it is definitely NOT fixed. php -v says: ================= PHP 5.3.1 (cli) (built: Feb 15 2010 17:30:23) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies ================= Test file: ================= <?= json_encode(array('test' => 'hello/world')) . chr(10); ================= Result: ================= {"test":"hello\/world"} ================= Previous Comments: ------------------------------------------------------------------------ [2009-08-22 10:11:12] scottmac@php.net Definitely fixed in 5.3 scott-mbp:~ scott$ php /tmp/test.php string(10) "Black/Gray" string(10) "Black/Gray" ------------------------------------------------------------------------ [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/bug.php?id=49323&edit=1

« previous php.bugs (#148994) next »