Skip to content

Commit

Permalink
Merge pull request #10944 from stalker780/patch-18
Browse files Browse the repository at this point in the history
OC4: fix broken utf8_substr with default 0 length
  • Loading branch information
danielkerr committed May 30, 2022
2 parents 03e7d07 + 3a2c5aa commit 7425e8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions upload/system/helper/utf8.php
Expand Up @@ -16,7 +16,7 @@ function utf8_strrpos(string $string, string $needle, int $offset = 0) {
}

function utf8_substr(string $string, int $offset, int $length = 0) {
if ($length === '') {
if ($length == 0) {
return mb_substr($string, $offset, utf8_strlen($string));
} else {
return mb_substr($string, $offset, $length);
Expand Down Expand Up @@ -45,7 +45,7 @@ function utf8_strrpos(string $string, string $needle) {
}

function utf8_substr(string $string, int $offset, int $length = 0) {
if ($length === '') {
if ($length == 0) {
return iconv_substr($string, $offset, utf8_strlen($string), 'UTF-8');
} else {
return iconv_substr($string, $offset, $length, 'UTF-8');
Expand Down

0 comments on commit 7425e8b

Please sign in to comment.