Bug #52161 [Fbk->Csd]: json_encode encoding HTML tags within strings incorrectly

From: Date: Mon, 09 Aug 2010 01:21:54 +0000
Subject: Bug #52161 [Fbk->Csd]: json_encode encoding HTML tags within strings incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153262@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52161&edit=1 ID: 52161 Updated by: felipe@php.net Reported by: niazuddin dot ahmed at gmail dot com Summary: json_encode encoding HTML tags within strings incorrectly -Status: Feedback +Status: Closed Type: Bug Package: JSON related Operating System: RedHat PHP Version: 5.3.2 -Assigned To: +Assigned To: felipe Block user comment: N New Comment: I got the expected result. Closed. Previous Comments: ------------------------------------------------------------------------ [2010-06-23 22:54:29] johannes@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ can't reproduce ------------------------------------------------------------------------ [2010-06-23 18:22:33] niazuddin dot ahmed at gmail dot com Description: ------------ When using json_encode for strings with HTML tag, end tag gets HTML encoded but the start tag is left alone Test script: --------------- echo json_encode(array('test' => '<b>Bold</b>')); Expected result: ---------------- {"test":"<b>Bold</b>"} This is valid JSON as per http://www.jslint.com/ Actual result: -------------- {"test":"<b>Bold&lt;\/b&gt;"} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52161&edit=1

« previous php.bugs (#153262) next »