|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47130 JSON problems
Submitted: 2009-01-16 15:56 UTC Modified: 2009-01-20 12:09 UTC
From: svacinap at compsys dot cz Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.2.8 OS: Linux Slackware 12.1
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.
Block user comment
Status: Assign to:
Bug Type:
From: svacinap at compsys dot cz
New email:
PHP Version: OS:


 [2009-01-16 15:56 UTC] svacinap at compsys dot cz
Please read this:

php log: 

[Fri Jan 16 10:26:34 2009] [error] [client] PHP Warning:  json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /var/www/mail/modules/email/json.php on line 1310


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-17 18:26 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.
 [2009-01-18 02:49 UTC] svacinap at compsys dot cz
Hi, thanks for interest :-) I am not a php programmer, so I don't know howto help any better, sorry. In the apache error log you can see this: /var/www/mail/modules/email/json.php on line 1310

so line 1310 is the last line of the json.php code, it's end like this: 

}catch(Exception $e)


echo json_encode($response);


line 1310 is this: echo json_encode($response);

I don't really know If this is help to you. Please let my know, I will contact programmer of this code. 

 [2009-01-18 15:37 UTC]
Any strings passed to json_encode should be valid utf-8, the manual 
and error message make this clear.
 [2009-01-19 13:54 UTC] svacinap at compsys dot cz
OK, but there were no problems with json_encode (the same script) in the php version 5.2.5 and 5.2.6 .. So I don't understant what is wrong. 

Here you have whole script:
 [2009-01-19 16:00 UTC]
It didn't work before, it just silently cut the string in half and you never noticed it.

See bug #43941
 [2009-01-19 21:17 UTC] svacinap at compsys dot cz
OK. Group-office is the php web aplication .. 
I am IT administrator of the linux systems, NOT a programmer (my fault) ... 

OK. If I have Groupoffice3 and php 5.2.6 on my server, I can read the email messages, no problem, no errors :

OK. If I have updated php to recent version 5.2.8, some of messages which have been made in the php aplication Groupoffice3 CAN NOT be read:

So php developer says: "This is php bug" , so php developers says "This is not bug". OKI. Sorry I don't know what to think, because I am not goddam programmer at all ... :-(
 [2009-01-19 21:24 UTC] svacinap at compsys dot cz
I meant: So Groupoffice3 developer says: "This is php bug"
 [2009-01-19 21:54 UTC]
The fact that it worked before was the bug. It's now doing what it 
should have done in the first place.
 [2009-01-20 00:04 UTC] svacinap at compsys dot cz
OK. Thanks for all the replies and your time. Thanks very much.
 [2009-01-20 11:38 UTC] svacinap at compsys dot cz
Developer of the Groupoffice3 is saying: 

How can I work around then when a string contains invalid UTF-8 data? Is 
there a function to strip invalid chars?

I wrote an e-mail client and with 5.2.6 it worked fine and now my app 
stops working when there is an invalid char in an incomming e-mail. I 
have no control of that of course so I need a function to make the data 
 [2009-01-20 12:09 UTC]
It really depends on what the context is and this sort of thing should be asked on the users list.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 21 04:01:30 2024 UTC