? ? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
18 Apr 2019

Pull Request for Issue #24631 .

Summary of Changes

added a check to prevent to save too large module content > 65535

Testing Instructions

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

Expected result

an error message is displayed that you are not permitted to save too large content

Actual result

no check

9eb2aea 18 Apr 2019 avatar alikon lang
avatar alikon alikon - change - 18 Apr 2019
Status New Pending
avatar alikon alikon - open - 18 Apr 2019
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2019
Category Administration com_modules Language & Strings
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 Apr 2019

@ricomonkeon please test.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 18 Apr 2019

@alikon is it okay for you if i copy the testing instructions from #24631?

avatar alikon alikon - change - 18 Apr 2019
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2019
Category Administration com_modules Language & Strings Administration com_modules Language & Strings Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 18 Apr 2019
Category Administration com_modules Language & Strings Libraries Administration Language & Strings Libraries
avatar alikon
alikon - comment - 18 Apr 2019

@franz-wohlkoenig feel free to do it

avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Apr 2019
The description was changed
avatar franz-wohlkoenig franz-wohlkoenig - edited - 18 Apr 2019
avatar ricomonkeon
ricomonkeon - comment - 18 Apr 2019

Just tested it. I'm out of my depth in this part of Joomla, but should it not be $data[content] instead of $this->content ? (the $this object does not seem to contain the submitted data)
Also, note that if you add an editor field type in your module, then it does not use the content field, but saves it as part of a json string in the params field with the rest of the data. Only customContent seems to use the content field.
The failure in $data[content] isn't actually as bad - it's the broken json string in params which causes a fatal error.

avatar alikon
alikon - comment - 18 Apr 2019

well i've only experienced with content .... btw added the check on params too
please re-test

avatar ricomonkeon
ricomonkeon - comment - 18 Apr 2019

$this->content and $this->params always seem to return a length of zero.

It feels like -
if ((strlen($this->content) > 65535) || (strlen($this->params) > 65535))
Should be something like -
if ((strlen($data[content]) > 65535) || (strlen(json_encode($data[params])) > 65535))
The latter works on my test, but I'm not sure how tidy my code is.

avatar alikon
alikon - comment - 18 Apr 2019

can you post the zip of your module please

avatar mbabker
mbabker - comment - 18 Apr 2019

t feels like -
if ((strlen($this->content) > 65535) || (strlen($this->params) > 65535))
Should be something like -
if ((strlen($data[content]) > 65535) || (strlen(json_encode($data[params])) > 65535))

Make sure you're editing the right file. In the table's check() method, the properties are bound to the class before it is called so $this->foo should be what you're using in that context.

If you're having to check $data['foo'] then you might be editing the wrong file.

avatar ricomonkeon
ricomonkeon - comment - 18 Apr 2019

Apologies. I was indeed editing the wrong file.
The bug is now fixed - good work!

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Apr 2019

@ricomonkeon please mark your test in Issue Tracker as successfully > https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results

avatar HLeithner
HLeithner - comment - 19 Apr 2019

2 questions.

  1. Why do you limit the params mediumtext column to 65k chars? it should be 16m
  2. Why do we limit to text, we as joomla has no gain from this, especially if we don't have another column that can be used for meta data.

params would be such column but it seams that it isn't used by devs for there needs, why don't they use it and would a new column dedicated for easy use better?

avatar HLeithner
HLeithner - comment - 19 Apr 2019

and btw. this is a real bad user experience if you edit something and the system tells you I can't save it without any help how to solve it. Especially when extensions are abusing this field and fill it with json data that isn't seen or can't be modified by the user.

avatar alikon
alikon - comment - 19 Apr 2019

both field content and params are declared as text
https://github.com/joomla/joomla-cms/blob/staging/installation/sql/mysql/joomla.sql#L1498
https://github.com/joomla/joomla-cms/blob/staging/installation/sql/mysql/joomla.sql#L1509

so 65,535 characters should be the max length allowed iirc

the goal of this pr is really simple: only to prevent data truncation, it's only a band-aid
not a schema redesign nor a complete review of Exception flows as correctly Michael pointed out #24635 (comment)

avatar HLeithner
HLeithner - comment - 19 Apr 2019

sorry about the mediumtext, the first website I checked had it as mediumtext and I don't know why.

ok then I understand thx.

avatar ricomonkeon
ricomonkeon - comment - 19 Apr 2019

I have tested this item successfully on 406da01


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

avatar ricomonkeon ricomonkeon - test_item - 19 Apr 2019 - Tested successfully
avatar viocassel
viocassel - comment - 20 Apr 2019

I have tested this item successfully on 93e3505


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

avatar viocassel viocassel - test_item - 20 Apr 2019 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Apr 2019

@HLeithner set this on RTC or retest of @ricomonkeon needed?

avatar zero-24
zero-24 - comment - 20 Apr 2019

No need to retest. We just need to get appveyor running. Let me reboot him

avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Apr 2019
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Apr 2019

Status "Ready To Commit".

avatar zero-24 zero-24 - alter_testresult - 20 Apr 2019 - ricomonkeon: Tested successfully
avatar HLeithner HLeithner - close - 20 Apr 2019
avatar HLeithner HLeithner - merge - 20 Apr 2019
avatar HLeithner HLeithner - change - 20 Apr 2019
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-04-20 13:25:03
Closed_By HLeithner
Labels Added: ?
avatar anirudh7
anirudh7 - comment - 11 Jun 2021

But why text limitations? I have 60+ Speakers attending the conference, and I want to use as a module in multiple paces.

Add a Comment

Login with GitHub to post a comment