Bug #75403
closedjson_encode-Problem
0%
Description
I updated from 6.2.14 to 6.2.19 and the error still appears
Core: Error handler (BE): PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in /.../typo3_src/typo3_src-6.2.14/typo3/sysext/core/Classes/Log/Writer/FileWriter.php line 125
and I can still fix it with:
array_walk_recursive($recordData, function(&$item, $key){
if(!mb_detect_encoding($item, 'utf-8', true)){
$item = utf8_encode($item);
}
});
No, I don't know where the non UTF8 chars come from - how can I check that?
This error is related to https://forge.typo3.org/issues/68582
Files
Updated by Wouter Wolters over 8 years ago
- Status changed from New to Needs Feedback
What is the actual data that is being logged, can you figure that out?
Updated by Chili no-lastname-given over 8 years ago
To be honest: I can't.
I had a look in the error and access log of my server and there is no error and no warning in the time the error appears in my typo3.log.
Updated by Wouter Wolters over 8 years ago
Without more information we can't help you with solving your issue.
We really need more information were this data comes from. Can you debug the code at this point and print out that data?
Updated by Chili no-lastname-given over 8 years ago
Okay, I was able to write the content of the array $recordData in a file and the error occurs whenever an error is written into the log.
So I tried a login with wrong parameters to force Typo3 to write into the log and the values of the array where (the second one is the IP adress):
wrongadmin
123.456.78.9 ()
2
I could not print the array out. When I write something like echo, var_dump or print in the line above (FileWriter.php, above $data = '- ' . json_encode($recordData);
) then nothing ist printed out, I'm sorry.
Updated by Andreas Kienast over 8 years ago
You may write that stuff into a file, e.g: file_put_contents(PATH_site . '/typo3temp/recordData.log', print_r($recordData, true));
This writes the output of print_r() into typo3temp/recordData.log
Updated by Chili no-lastname-given over 8 years ago
- File recordData.log recordData.log added
I attached the file with the content of $recordData.
I asked myself if this error occurs because of php 5.4 .
I don't have the permission to update the php version, so I'm not able to test my assumption. Perhaps someone else can figure out if it's the version?
Updated by Wouter Wolters over 8 years ago
This does not look the data that gives you the error. Please log for a while and see if there are any special characters in there.
Updated by Chili no-lastname-given over 8 years ago
I did what you said but I still got the same data in the file. Perhaps it's something special in the configuration of the server. We'll use Typo3 7 at the end of the year. Perhaps the problem disappears ;) and in the meanwhile I can fix it with the workaround above.
Updated by Wouter Wolters over 8 years ago
- Status changed from Needs Feedback to Closed
I'm closing this issue. I hope the problem is solved for you when you start using 7.6.
There is not enough information to reproduce it on my system. Hope that is ok with you.