From: Operating system: RedHat PHP version: 5.3.2 Package: JSON related Bug Type: Bug Bug description:json_encode encoding HTML tags within strings incorrectly
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<\/b>"}
--
Edit bug report at http://bugs.php.net/bug.php?id=52161&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52161&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52161&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52161&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52161&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52161&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52161&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52161&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52161&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52161&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52161&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52161&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52161&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52161&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52161&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52161&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52161&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52161&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52161&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52161&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52161&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52161&r=mysqlcfg
