Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ff9e6ec

Browse files
Merge pull request #11 from hexmode/substr-bug
mb_substr() treats $length differently than substr()
2 parents bcac3b9 + 1d508ed commit ff9e6ec

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)

AltStyle によって変換されたページ (->オリジナル) /