Commit 2a210685 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction de Util::truncatedString boguée

parent a668402e
Pipeline #9122 failed with stages
in 14 seconds
......@@ -338,11 +338,20 @@ class Util
if (strlen($string) <= $length) {
return $string;
}
$trunc = substr($string, 0, $length);
if ($string[$length] === ' ') {
return substr($string, 0, $length) . $appended;
$kept = $trunc;
} else {
$found = strrpos($trunc, ' '); // position du dernier espace
if ($found === false) {
$kept = $trunc;
} else {
$kept = substr($string, 0, $found); // on tronque à l'espace trouvé
}
}
return substr($string, 0, strrpos(substr($string, 0, $length), ' ')) . $appended;
return $kept . $appended;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment