diff options
Diffstat (limited to 'src/Binary.php')
-rw-r--r-- | src/Binary.php | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Binary.php b/src/Binary.php index 03476db..92bd9e3 100644 --- a/src/Binary.php +++ b/src/Binary.php @@ -69,16 +69,12 @@ abstract class Binary int $start = 0, $length = null ): string { - if (\function_exists('mb_substr')) { - // $length calculation above might result in a 0-length string - if ($length === 0) { - return ''; - } - return \mb_substr($str, $start, $length, '8bit'); - } if ($length === 0) { return ''; } + if (\function_exists('mb_substr')) { + return \mb_substr($str, $start, $length, '8bit'); + } // Unlike mb_substr(), substr() doesn't accept NULL for length if ($length !== null) { return \substr($str, $start, $length); |