Reproduce:

Add a node who's title will be calculated as longer than 225.
Press Save.
Drupal set message says it's been created with the full calculated title, but title of node will be 225 characters.

This could be bad if anything else is using the inaccurate title.

Node title enforces this by using '#size' on the title textfield.

Comments

Status:Needs review» Needs work

sounds good, could we add a comment to add it explaining why we need to do that?

Status:Needs work» Fixed

I just added that in and committed it to all d5, d6 + added it into d7. thanks.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:6.x-1.x-dev» 7.x-1.x-dev
Status:Closed (fixed)» Needs review
StatusFileSize
new613 bytes

Sorry to open it, but I realized, the substr is not a solution for utf8 strings. I attached a patch, it uses truncate_utf8() to truncate the title to 255 character not substr().

Patch is for 7.x-1.x version.

StatusFileSize
new578 bytes

Patch for 6.x-1.x.

need change:

<?php
$node
->title = substr($node->title, 0, 255);
?>

to
<?php
$node
->title = mb_substr($node->title, 0, 255);
?>

is good work.

Status:Needs review» Needs work

drupal_substr?

Status:Needs work» Needs review
StatusFileSize
new604 bytes
new569 bytes
new569 bytes

Please, use drupal_substr().

It was very hard to find a reason of PDO exception which was caused by this bug.

Priority:Minor» Major
Status:Needs review» Reviewed & tested by the community

This could cause a data-loss in titles so major

Annoying bug. Please commit the simple patches.

Priority:Major» Critical