Issue Bug Closed

#21323t3lib_cs::cropMbstring has problems with negative length

Steffen Gebert 10/21/09, 10:18 updated 08/06/10, 13:31

Description

function cropMbstring($charset, $string, $len, $crop = ‘’)

as always, $len can also be negative and is correctly handled.

But the check, weather the string should really be truncated is as followed:
if (intval($len) == 0 || mb_strlen($string) < $len) {
return $string;
}

So, if $len < 0, we never return here, but later prepend “…”.

Solution: check length < abs($len)

One example, where this can be seen is the pagepath on the top right.
(issue imported from #M12297)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.