diff --git a/CHANGELOG.md b/CHANGELOG.md index 34cd1ac78..38fc3320a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Set response code in some cases [\#1319](https://github.com/torrentpier/torrentpier/pull/1319) ([belomaxorka](https://github.com/belomaxorka)) - Fixed `admin_terms.php` textarea reset in preview mode [\#1371](https://github.com/torrentpier/torrentpier/pull/1371) ([belomaxorka](https://github.com/belomaxorka)) - Fixed broken user dl status [\#1351](https://github.com/torrentpier/torrentpier/pull/1351) ([belomaxorka](https://github.com/belomaxorka)) +- Fixed: mb_strlen(): Passing null parameter [\#1374](https://github.com/torrentpier/torrentpier/pull/1374) ([belomaxorka](https://github.com/belomaxorka)) - Fixed auth(): empty $f_access [\#1329](https://github.com/torrentpier/torrentpier/pull/1329) ([belomaxorka](https://github.com/belomaxorka)) - Fixed download counter for torrents [\#1346](https://github.com/torrentpier/torrentpier/pull/1346) ([belomaxorka](https://github.com/belomaxorka)) - Fixed HTTP 500 while cron running in server-side [\#1321](https://github.com/torrentpier/torrentpier/pull/1321) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/includes/functions.php b/library/includes/functions.php index 28bb227e6..105caadf4 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -774,7 +774,7 @@ function get_user_id($username) function str_short($text, $max_length, $space = ' ') { - if ($max_length && mb_strlen($text, 'UTF-8') > $max_length) { + if (!empty($max_length) && !empty($text) && (mb_strlen($text, 'UTF-8') > $max_length)) { $text = mb_substr($text, 0, $max_length, 'UTF-8'); if ($last_space_pos = $max_length - (int)strpos(strrev($text), (string)$space)) { @@ -787,7 +787,7 @@ function str_short($text, $max_length, $space = ' ') $text = preg_replace('!&#?(\w+)?;?(\w{1,5})?\.\.\.$!', '...', $text); } - return $text; + return $text ?? ''; } function wbr($text, $max_word_length = HTML_WBR_LENGTH)