?
avatar davidascherG
davidascherG
30 May 2017

Steps to reproduce the issue

in all my articles that were created before May 2012 (I am not sure which Joomla! version that would have been) the Json decoding problem re-appeared when I upgraded to Joomla! v 3.7.2 from Joomla! 3.4.8 and with PHP v5.6.30. The front end displays the usual Json error when displaying the article and the backend displays:
An error has occurred.
0 Error decoding JSON data: Syntax error

Those old articles have metadata that looks like this:

{"robots":"","author":"","rights":"","xreference":""}

I cannot imagine HOW it ended up this way.... it is obviously very wrong. NONE of the extensions I have used on the site would have touched the content metadata field, so I suspect that this bad stuff was entered by some prior version of the joomla core. And that means that this is probably not the only site that will experience this problem as they update to Joomla 3.7.2. Oddly, the problem does not occur when viewing the same articles in Joomla version 3.4.8 --- and yes, I checked and the metadata is identical bad stuff.

I was able to get around this for now by changing line line 71 in libraries/vendor/joomla/registry/src/Format/Json.php from
$decoded = json_decode($data);
to
$decoded = json_decode( htmlspecialchars_decode (html_entity_decode($data, ENT_QUOTES ) ) ) ;

Expected result

proper display of article

Actual result

Json error in libraries/vendor/joomla/registry/src/Format/Json.php

System information (as much as possible)

This what I got from my hosting provider - SiteGround
Operating system – CentOS 6.4 (Final) (64 bit)
Apache Version – Apache 2.4 – This Web Server is modified by us
PHP Versions- PHP 5.6.3
MySQL* Version – MySQL 5.6
Zend Optimizer – 3.3.3
zlib/1.2.3
libidn/0.5.6
Kernel version – 3.12.18-clouder0 – This Kernel is our own build!
mod_rewrite is installed

Additional comments

This is a problem that needs to be fixed once and for all in the Joomla kernel. It has nothing to do with extensions of any kind. It makes no sense to penalize people who have been using Joomla for a long time by telling them they have to fix their databases (as was recommended before). This is a Joomla core problem; not a user problem; not an extension problem.

avatar davidascherG davidascherG - open - 30 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 30 May 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 May 2017
avatar davidascherG davidascherG - edited - 30 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 30 May 2017
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 30 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 May 2017
Category com_content
avatar tonypartridge
tonypartridge - comment - 30 May 2017

What editor are you using on these sites out of curiosity?

avatar mbabker
mbabker - comment - 30 May 2017

The only code fix that can be made is to revert to the previous behavior of silently ignoring broken JSON data, which is bad for a lot more reasons than the current issue of the system groaning and not handling this error state. We generally do not commit SQL updates to user data, and attempting to scan for this issue and resolve it as part of a regular update would be rather problematic and potentially lead to timeouts while running the update depending on the size of your site.

FWIW, this is the first report I've seen where quotes were HTML encoded in the database, usually it's some other syntax error (too much escaping on quotes, invalid bracket count) that is the issue. And FWIW, core doesn't have a process that tries to HTML encode JSON fields before storing it to the database, how it got there along the way would just be playing the blame game between us and extension developers and lead to annoyed people with no productive result.

So, as annoying as it is, the only fix is for users to correct their database to ensure valid JSON strings are stored in it or demand that Joomla revert the error checking which gives the impression your site is working but whatever data was supposed to be used in that broken string won't be read and that could lead to things not working the way you expect (some data not being used in the right context for example).

avatar joomla-cms-bot joomla-cms-bot - change - 30 May 2017
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 30 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 May 2017
Status New Discussion
avatar brianteeman brianteeman - change - 30 May 2017
The description was changed
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-05-30 07:48:03
Closed_By brianteeman
avatar brianteeman brianteeman - close - 30 May 2017
avatar brianteeman
brianteeman - comment - 30 May 2017

It is a 2 second fix using https://github.com/renekreijveld/JoomlaJsonCheck

For the record you onlly just discovered it because you didnt keep your site upto date.

If you need further support please use the forum http://forum.joomla.org

avatar davidascherG
davidascherG - comment - 30 May 2017

jedit. since the site started way back with Joomla 1.x.


From: Tony Partridge [mailto:notifications@github.com]
Sent: Tuesday, May 30, 2017 1:43 AM
To: joomla/joomla-cms
Cc: davidascherG; Author
Subject: Re: [joomla/joomla-cms] Json decoding issue (again) (#16348)

What editor are you using on these sites out of curiosity?

You are receiving this because you authored the thread.
Reply to this email directly, view
#16348 (comment)
it on GitHub, or mute
<https://github.com/notifications/unsubscribe-auth/AJOtNikf1OSlrmSedSQObydjy
TneAqbXks5r-6x3gaJpZM4Npup3> the thread.
<https://github.com/notifications/beacon/AJOtNs_69v2rHO_IRkpkZvNTlXkHGp8Bks5
r-6x3gaJpZM4Npup3.gif>

Add a Comment

Login with GitHub to post a comment