Opened 4 years ago

Last modified 11 months ago

#10377 new defect (bug)

Comment fields should have max lengths

Reported by: muriloazevedo Owned by:
Priority: normal Milestone: Future Release
Component: Comments Version: 2.8
Severity: normal Keywords: 'sql exception' comments
Cc: hellokane@…

Description

Hello, I don't know if exactly it's a bug or use javascript validation, but i think so there's no
treatment for this, or was fix in the new version.

In the section of comments(Wordpress 2.8), we can insert how many characheters we wants, generating an SQL Exception and breaking the all system.

The solution is simple, use the property maxlenght in the tag
<input /> e limit the characters if will be send to database.

Change History (5)

comment:1 follow-up: ↓ 3   dd324 years ago

  • Milestone changed from Unassigned to Future Release

The solution is simple, use the property maxlenght in the tag <input /> e limit the characters if will be send to database.

That doesnt stop people from directly posting the data anyway..

The comment_content field is a TEXT field:

BLOB 
TEXT 
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters. See section 7.7.1 Silent column specification changes. 
MEDIUMBLOB 
MEDIUMTEXT 
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters. See section 7.7.1 Silent column specification changes. 
LONGBLOB 
LONGTEXT 
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters. See section 7.7.1 Silent column specification changes.

so theres a limit of 65,535 characters in a comment at present.. Perhaps the comment handler should throw a error upon a longer comment.

comment:2   dd324 years ago

also note, That MySQL should actually truncate the data if its longer, not throw an error..

comment:3 in reply to: ↑ 1   azaozz4 years ago

Replying to dd32:

... so there's a limit of 65,535 characters in a comment at present.. Perhaps the comment handler should throw a error upon a longer comment.

There's some basic back-end validation already (duplicate comments, non-empty name and email, etc.). Adding max length for all comment fields should be trivial.

Actually this may be good for most POST requests in the admin including AJAX.

  • Summary changed from Problem in comments! to Comment fields should have max lengths
  • Cc hellokane@… added
Note: See TracTickets for help on using tickets.