Opened 20 years ago
Closed 20 years ago
#1474 closed defect (bug) (fixed)
Incorrect string cut for localized title and excerpt in wp_trackback.php.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | 1.6 |
| Component: | General | Keywords: | bg|has-patch bg|2nd-opinion |
| Focuses: | Cc: |
Description
Somewhere in wp_trackback.php (string 71,72,73):
$title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title;
$excerpt = strip_tags($excerpt);
$excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt;
Function substr working properly only for english UTF-8 strings because codes of latin letters in ASCII same to UTF-8. But for cyrillic and other national symbols function substr works incorrectly.
I recommend replace all substr inclusions for language-sensitive data with function wp_substr():
function wp_substr() {
$function (function_exists('mb_substr'))?'mb_substr':'substr';
return call_user_func_array($function, func_get_args());
}
Change History (3)
Note: See
TracTickets for help on using
tickets.
Seems like a good idea. Any subtle gotchas ?