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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jan at horde dot org
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC