Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | 937086-innacurate-title-d5.patch | 569 bytes | andyceo |
#8 | 937086-innacurate-title-d6.patch | 569 bytes | andyceo |
#8 | 937086-innacurate-title-d7.patch | 604 bytes | andyceo |
#5 | truncate_title_utf8_aware-d6-937086-5.patch | 578 bytes | Denes.Szabo |
#4 | truncate_title_utf8_aware-937086-4.patch | 613 bytes | Denes.Szabo |
Comments
Comment #1
fagosounds good, could we add a comment to add it explaining why we need to do that?
Comment #2
fagoI just added that in and committed it to all d5, d6 + added it into d7. thanks.
Comment #4
Denes.Szabo CreditAttribution: Denes.Szabo commentedSorry 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.
Comment #5
Denes.Szabo CreditAttribution: Denes.Szabo commentedPatch for 6.x-1.x.
Comment #6
hdcoder CreditAttribution: hdcoder commentedneed change:
to
is good work.
Comment #7
hefox CreditAttribution: hefox commenteddrupal_substr?
Comment #8
andyceo CreditAttribution: andyceo commentedPlease, use drupal_substr().
It was very hard to find a reason of PDO exception which was caused by this bug.
Comment #9
andypostThis could cause a data-loss in titles so major
Comment #10
maximpodorov CreditAttribution: maximpodorov commentedAnnoying bug. Please commit the simple patches.
Comment #11
maximpodorov CreditAttribution: maximpodorov commentedComment #12
anmolgoyal74 CreditAttribution: anmolgoyal74 at OpenSense Labs for DrupalFit commented"truncate_title_utf8_aware-937086-4.patch" applies successfully.
And truncate_utf8() is better solution
Comment #14
gaurav.kapoor CreditAttribution: gaurav.kapoor commented