J3 Issue ?
avatar ricomonkeon
ricomonkeon
17 Apr 2019

Steps to reproduce the issue

Create a module containing a field type of editor.
Using this module, enter any content which exceeds 65535 characters.

Expected result

An admin would expect it just to save all the content, but realistically a warning saying you cannot enter that much content, and the ability to edit down accordingly would seem sensible.

Actual result

An "Error decoding JSON data" error appears on both the front and back end of the site (when you try and edit the module, or view it on the front). The module cannot then be accessed via the admin, and if you go into the database you notice that the JSON string is incomplete, as it has only saved the first 65535 characters.

Additional comments

I suspect what is required is to validate the json string for length before adding it to the database.

I tried using the customContent method of adding data. This doesn't break as seriously (as it does not use json), but any additional characters are also cropped.

avatar ricomonkeon ricomonkeon - open - 17 Apr 2019
avatar joomla-cms-bot joomla-cms-bot - change - 17 Apr 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Apr 2019
avatar brianteeman
brianteeman - comment - 17 Apr 2019

Why on earth are you putting war and peace in a module?

avatar ricomonkeon
ricomonkeon - comment - 17 Apr 2019

Heheh. It was actually an admin copy-pasting an image which triggered it - the editor converts that to base64 (which uses a lot of characters).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24631.

avatar joeforjoomla
joeforjoomla - comment - 17 Apr 2019

This happened to one extension of mine too.
Saving editor contents in a single JSON database field it's not so difficult that users exceed that 65535 bytes limit.
I had to include a check into my extension to prevent saving and warn the user in this situation, indeed being this field used by a system plugin, the result was a disaster. The entire website frontend/backend was likely to be unreachable showing "Error decoding JSON data" error

avatar brianteeman
brianteeman - comment - 17 Apr 2019

If you submitted a PR then everyone would benefit

avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 18 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Apr 2019
Status New Discussion
avatar mbabker
mbabker - comment - 18 Apr 2019

This is a repeat of the usual "X field in Y table should be changed from TEXT to LONGTEXT because I'm trying to store too much data into this database column" request, only I think this might be the first for #__modules.content (usually it's the #__extensions or #__template_styles tables, though I also vaguely remember one issue in the past because people someone was trying to do full articles in modules instead of using com_content).

avatar Quy
Quy - comment - 18 Apr 2019

I also vaguely remember one issue in the past because people someone was trying to do full articles in modules instead of using com_content

Maybe this one #19618

avatar ricomonkeon
ricomonkeon - comment - 18 Apr 2019

I don't think it should be changed to LONGTEXT - it's ultimately a mistake to add that much text. The bug I'm reporting is that it breaks the site rather than fails gracefully, due to the field containing a JSON string which is not being validated for its length and so becomes invalid when it doesn't save properly.

Admins always do unexpected things they they need to be told not to - massive images etc, but to be able to actually break the site doing something unwise but understandable (pasting an image into the editor in this case) seems like a bug that needs fixing.

It could perhaps be argued that the issue is TinyMCE converting pasted images to base64, I suppose. The result is the same.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24631.

avatar alikon
alikon - comment - 18 Apr 2019

with #24635 now a check is made to prevent this behaviour
please test

avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Apr 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-04-18 17:34:18
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig franz-wohlkoenig - close - 18 Apr 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 Apr 2019

Closed as having Pull Request.

Add a Comment

Login with GitHub to post a comment