Author: arod.shatil
Description:
Edit comment/summary is limited to 200 chars by use of maxlength=200 in the edit form.
however, the database field (rev_comment column in revisions table) is "tinyblob" which can only hold 255 bytes. in unicode, 200 characters can be up to 600 or even 800 bytes or so (may be rare, but 2:1 is pretty much the rule for any non-latin-alphabeth language).
in addition, EditPage.php contains the line:
$this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250, '' );
(around line 559 in 1.15.1).
"truncate" also works on bytes and not characters, due to its use of "substr".
remedy:
<code=sql>
alter table revisions modify column rev_comment blob not null;
(can be safely run on upgrades - mysql will copy the content of the tinyblob without complains)
</code>
change the "250" to "600" or so in EditPage.php#559.
alternatively, you might be able to teach "truncate" to count utf-8 chars instead of bytes. in this case you probably want to change the "250" in EditPage.php to "200".
this can be achieved by something like:
<code=php>
function mysubstr($str, $length) {
return function_exists("mb_substr")?mb_substr($str,$len):substr($str,$len);
}
</code>
and replace the calls to substr by calls to "mysubstr". (this is a sketch - you need to accommodate for some optional params).
if you do the latter, i think you can change the "250" in EditPage.php to "200", which may actually be nicer that kicking it up to 600 and staying with the broken substr.
(apologies for not submitting a "real" patch - i will once you guys upgrade to git.)
the alternative, i.e. to limit "maxlength" to less than 200 is not a good idea, because sometimes you *do* need more than 100 chars to describe an edit, and anyway, to be on the safe side you'll need to limit it to 50 which is unacceptable.
the above will solve the problem for storage of comments and for displaying them on the page history, but for "latest changes" there is a further truncation somewhere which i haven't located yet, so you'll need to hunt it also.
Version: 1.15.x
Severity: major