News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

"JSON decode error: Control character error, possibly incorrectly encoded"

Started by Wolpo, November 01, 2022, 11:57:52 AM

Previous topic - Next topic

Wolpo

Hello,

thanks for the update 2.1.2 -- it's been working fine. Sometimes I just get this error (from a guest):


------------------------
Error message:
JSON decode error: Control character error, possibly incorrectly encoded

File:
.../Sources/Errors.php

Line:
564

URL of page causing the error:
.../index.php?action=php://filter/convert.iconv.UTF8.CSISO2022KR
|convert.base64-encode
|convert.iconv.UTF8.UTF7
|convert.iconv.CP866.CSUNICODE
|convert.iconv.CSISOLATIN5.ISO_6937-2
etc. (about 100 lines)

Backtrace information:

#0: smf_json_decode()
Called from .../Sources/Errors.php on line 564

#1: log_error_online()
Called from .../Sources/Errors.php on line 237

#2: fatal_lang_error()
Called from .../index.php on line 449

#3: smf_main()
Called from .../index.php on line 191

------------------------



As far as I can see, it doesn't break my forum. But I'd like to know what the cause is.

Can anyone help?


Thank you!

TwitchisMental

Hello Wolpo,

To help get this issue resolved, would you please answer these questions.

What version of SMF did you update from?

Do you have any mods installed? If so, which ones?

Do you have a custom theme installed?


Wolpo

Hello Nick,

I updated from version 2.0.18.

Clean install. No mods.

Default theme. I just replaced the background image file and the banner image.

Thanks.

TwitchisMental

Quote from: Wolpo on November 01, 2022, 04:03:20 PMHello Nick,

I updated from version 2.0.18.

Clean install. No mods.

Default theme. I just replaced the background image file and the banner image.

Thanks.
You could try rerunning the large upgrade package.

I am also gonna tag someone who has a bit more knowledge on issues like this.

@Doug Heffernan 

Wolpo

I assume the files are all OK as the forum works OK. I get over 1000 normal visits a day, and just one of them (a guest) leaves this error report once per day. It's from an IP in Russia with an address in Hong Kong. Maybe someone is trying some nonsense. Guests cannot post on my forum.

shawnb61

What is your DB type & version?

I am pretty sure that somewhere in your log_online table is a url that is VERY long and is getting truncated.  I suspect some user is presenting an unusually long USER AGENT when they connect somehow.

I would start off by finding such a record & deleting it. 

Note that I recently saw something almost identical on my site, & logged an error up on GH:
https://github.com/SimpleMachines/SMF/issues/7596

Same root issue - the URL being presented to log_online was too long.  I think the difference is my DB stopped it at storage time, you're getting the error at retrieval time because the JSON string is broken/truncated.  (That error message is what you get if you have a truncated JSON string...)  I bet the difference in behavior is probably just different DB versions, etc. 

If the issue comes back, let's see if we can propose a fix to #7596 for you to try.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Wolpo


shawnb61

This should be handled better.  I'm moving this to Bug Reports.  Tied to #7596...
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: