mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Fixed: mb_strlen(): Passing null parameter (#1374)
* Fixed: mb_strlen(): Passing null parameter * Update CHANGELOG.md * Update functions.php
This commit is contained in:
parent
5a975f20b8
commit
73eedb5c65
2 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue