Encoded characters may cause ticket subject to be too long

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
hpiirainen
Posts: 2
Joined: Fri Oct 19, 2018 7:34 am

Encoded characters may cause ticket subject to be too long

Post 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?
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

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

Post 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 '';
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
hpiirainen
Posts: 2
Joined: Fri Oct 19, 2018 7:34 am

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

Post by hpiirainen »

Thanks!

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