Skip to content

Commit 1d508ed

Browse files
committed
mb_substr() treats $length differently than substr()
1 parent bcac3b9 commit 1d508ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/TableFormatter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ protected function substr($string, $start = 0, $length = null)
273273
if (function_exists('mb_substr')) {
274274
return mb_substr($string, $start, $length);
275275
} else {
276-
return substr($string, $start, $length);
276+
// mb_substr() treats $length differently than substr()
277+
if ($length) {
278+
return substr($string, $start, $length);
279+
} else {
280+
return substr($string, $start);
281+
}
277282
}
278283
}
279284

0 commit comments

Comments
 (0)