After updating K2 to version 3.6.3, in the backend, when tried to edit one of items, I got this error:

Error decoding JSON data: Syntax error.

I figured out, that this probably means, that whatever column is trying to be processed by the Registry class has malformed JSON syntax. So far so good, but the debug output does not helped me much in locating the issue.

After checking zillions of pages on Google and trying out couple of solutions which sounded to be maybe meaningful ones, I have finally found the culprit - and the fix.

The explanation was given by one Joomler I highly respect, Michael Babker:

The common culprit I'm seeing for this is reading data from either the extensions or modules database tables. Both of them have `params` columns which have data stored in JSON format. To hit the line that tries to decode the JSON string to an object, the column has to have either a "{" as its first character or a "}" as its last character. If the column has a null or empty value, it won't reach this line.

And that was the point of enlightening ;)

The temporary fix was brutal, but effective.

BE AWARE that this will hack a core K2 file, save, do backups, put your seat belt and your preferred helmet (I personally vote for a CCM branded Ice Hockey one LOL).

Go to /administrator/components/com_k2/views/item/view.html.php and find this code:

		JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, array(
			'video',
			'params',
			'plugins'

		));

Replace it with this:

		JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, array(
			'video',
			'params',
			'plugins',
			'metadata'

		));

 

This solves the problem. Hopefully in one of next releases the problem will be fixed by K2 developers, and you won't need to do this. But right now was for me a lifesaver hack. Don't do it if you don't know, what you are doing!

0
0
0
s2sdefault
Category: Joomla Troubleshooter