New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent to save too large module content > 65535 #24635
Conversation
@@ -907,6 +907,14 @@ public function save($data) | |||
$isNew = true; | |||
$context = $this->option . '.' . $this->name; | |||
|
|||
// Prevent to save too large content > 65535 | |||
if (strlen($data['content']) > 65535) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type of validation belongs in the table class, not the model.
If character limitations are going to be checked, then this should be applied consistently across core and not only on this field IMO. Then again, from what I remember at least MySQL throws warnings about right truncating columns when the values are too big. Is this not happening consistently in Joomla, and if so why not!? It seems like that should be an Exception that someone can catch and handle more gracefully than this type of check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right as always, btw, should be a little bit better now....not perfect but....
check moved on table class
@ricomonkeon please test. |
@franz-wohlkoenig feel free to do it |
thanks @Quy Co-Authored-By: alikon <optimus4joomla@gmail.com>
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) |
well i've only experienced with |
$this->content and $this->params always seem to return a length of zero. It feels like - |
can you post the zip of your module please |
Make sure you're editing the right file. In the table's If you're having to check |
Apologies. I was indeed editing the wrong file. |
@ricomonkeon please mark your test in Issue Tracker as successfully > https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results |
2 questions.
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? |
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. |
both field 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 |
sorry about the mediumtext, the first website I checked had it as mediumtext and I don't know why. ok then I understand thx. |
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. |
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. |
@HLeithner set this on RTC or retest of @ricomonkeon needed? |
No need to retest. We just need to get appveyor running. Let me reboot him |
Status "Ready To Commit". |
But why text limitations? I have 60+ Speakers attending the conference, and I want to use as a module in multiple paces. |
Pull Request for Issue #24631 .
Summary of Changes
added a check to prevent to save too large module content > 65535
Testing Instructions
Expected result
an error message is displayed that you are not permitted to save too large content
Actual result
no check