php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44321 json_decode will not decode json string with chars like 
Submitted: 2008-03-04 12:29 UTC Modified: 2008-07-29 01:00 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: vzeman at gmail dot com Assigned: fb-req-jani (profile)
Status: No Feedback Package: JSON related
PHP Version: 5.2.5 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vzeman at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-04 12:29 UTC] vzeman at gmail dot com
Description:
------------
json_decode will not decode string if in value is string like "" 

Reproduce code:
---------------
try to decode string like this:
{"params":[{"body":"Hello,Regards,"}]}

Expected result:
----------------
params object should contain entry body with text: Hello,Regards,

Actual result:
--------------
encoding will stop on character R

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-19 19:32 UTC] tom at inetz dot com
I think the problem here is that json_decode has problems decoding strings with control characters.  I have experienced this problem with multiple control characters.
 [2008-06-28 19:16 UTC] work at anomalizer dot net
Agree with tom@ that the JSON spec does not permit control characters
See http://json.org/
Also try using a validator like http://www.jslint.com/
 [2008-07-21 21:34 UTC] jani@php.net
As clearly control characters are not allowed by the JSON spec, what exactly should happen here? IMO, it's working like it should now..
 [2008-07-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC