Page 1 of 1

Encoded characters may cause ticket subject to be too long

Posted: Fri Oct 19, 2018 8:09 am
by hpiirainen
Script URL:
Version of script: Hesk 2.8.2 + Mods For Hesk 2018.2.0
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

The "subject" input has a maxlength of 70 characters and "subject" column is of datatype VARCHAR(70). When submitting a ticket where the subject contains characters that are encoded (such as " or &), it can result in MySQL error "Data too long for column 'subject' at row 1", in which case the user sees a general MySQL error message. An example subject is Testing what would happen when the subject has "double quotes" in it.

Should there be more of a "buffer" between the maxlength and the MySQL length? Or should the inputs be validated (encode the input and calculate length) before inserting them to database to avoid MySQL errors?

Re: Encoded characters may cause ticket subject to be too long

Posted: Fri Oct 19, 2018 1:05 pm
by Klemen
Good point.

The subject is limited to 70 chars to keep it short and to the point. I will make sure the next version increases subject length in the database and truncates the data before sending it to MySQL.

As a temporary solution that should work in most practical applications, you can manually execute this query in your database:

Code: Select all

ALTER TABLE `hesk_tickets` CHANGE `subject` `subject` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '';

Re: Encoded characters may cause ticket subject to be too long

Posted: Fri Oct 19, 2018 1:32 pm
by hpiirainen
Thanks!

We already made a temporary increase for the column length to fix those problems.