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

From: Date: Wed, 23 Jun 2010 20:54:29 +0000
Subject: Bug #52161 [Opn->Fbk]: json_encode encoding HTML tags within strings incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151819@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: johannes@php.net Reported by: niazuddin dot ahmed at gmail dot com Summary: json_encode encoding HTML tags within strings incorrectly -Status: Open +Status: Feedback Type: Bug Package: JSON related Operating System: RedHat PHP Version: 5.3.2 New Comment: Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ can't reproduce Previous Comments: ------------------------------------------------------------------------ [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 (#151819) next »