php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57412 Escaped chars not unescaped
Submitted: 2006-12-01 13:13 UTC Modified: 2008-12-18 21:35 UTC
From: jan at horde dot org Assigned:
Status: Not a bug Package: json (PECL)
PHP Version: 5_2 CVS-2006-12-01 OS:
Private report: No CVE-ID: None
 [2006-12-01 13:13 UTC] jan at horde dot org
Description:
------------
json_decode() doesn't unescaped escaped characters like tabs, newlines, carriage returns etc. and doesn't understand single quotes.
A patch for 001.phpt (PHP_5_2 branch) is available at http://dev.horde.org/~jan/001.phpt.diff

Reproduce code:
---------------
var_dump(json_decode('"hello\\t\\"world\\""'));
var_dump(json_decode("'blah'"));

Expected result:
----------------
string(13) "hello	"world""
string(4) "blah"

Actual result:
--------------
string(16) "hello\t\"world\""
string(6) "'blah'"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-18 21:35 UTC] scottmac@php.net
The first one works correctly in 5.2.6 but the second is not 
valid JSON, it should be
"'blah'" or "blah"
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 06:01:26 2019 UTC