Joomla JSON Error Script

Joomla cms logo

When Joomla 3.6.3 was released, it included new validators for JSON data stored in the database.

Unfortunately, many extensions were storing invalid JSON in the database which triggered a fatal error. Even the default Joomla sample data inserted invalid data for menu items.

As a result, many people found themselves with a broken website after updating the Joomla core.

The Objective

The main issue had been identified, but the response from developers wasn’t going to help the average user.

The blame was pointed at third-party developers and that the core shouldn’t sacrifice proper validation to accommodate poor coding (As per the sample data). In general, I agree with this, but it could have been made to produce an error message, discarding the bad data without causing a fatal error.

I aimed to write a script to help people debug the issues with their site. 

The Process

Many specific causes had been noted in the GitHub issue comments:

I took sql fixes that had been tested and put them into a script.

Uploading the script to the root of your website and browsing to it would check and fix a common issue with the K2 component.

If there were still issues with the site, clicking the button for a deeper check would scan certain database columns for invalid data and report it back to the user.

The Result

It helped many people to get their sites back online after a failed update, and I still get thank you emails as people upgrade their sites from older versions.

Although the erroneous data couldn’t really be fixed automatically, it often pointed to the extension that was responsible, which led to updates in fixing the initial problem.

At the time I wrote this script, I hadn’t encountered the error. When I updated some websites later on and ran into the same problem, I was glad that I put in the work preemptively and could get the sites up and running in a short space of time.

You can find the original blog post here: