diff options
author | Scott <scott@paragonie.com> | 2017-05-04 00:53:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-04 00:53:33 -0400 |
commit | 38da9453f7e931ba54d96c385891d159d8deeed5 (patch) | |
tree | 5ebe63575aa431feb527e39bc7136b4a2ed140a7 | |
parent | 34838b89a29c0965d3ef790105f11d151951a87b (diff) | |
parent | bff1419d82fb1030ee2f88eb3a746f9facbe9f50 (diff) | |
download | constant_time_encoding-origin/HEAD.zip constant_time_encoding-origin/HEAD.tar.gz constant_time_encoding-origin/HEAD.tar.bz2 |
Merge pull request #8 from Inkeliz/masterHEADorigin/masterorigin/HEADmaster
Duplicated code
-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); |