Skip to content

Commit

Permalink
! mb_strlen(): Passing null to parameter #1 ($string) of type string …
Browse files Browse the repository at this point in the history
…is deprecated
  • Loading branch information
Spuds committed Jan 8, 2024
1 parent bddd172 commit 5581830
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions sources/subs/Util.class.php
Expand Up @@ -7,7 +7,7 @@
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause
*
* @version 1.1.9
* @version 1.1.10
*
*/

Expand Down Expand Up @@ -438,14 +438,21 @@ public static function strlen($string)
{
$ent_list = '&(#\d{1,7}|quot|amp|lt|gt|nbsp);';
if (function_exists('mb_strlen'))
return mb_strlen(preg_replace('~' . $ent_list . '|.~u', '_', $string), 'UTF-8');
{
$check = preg_replace('~' . $ent_list . '|.~u', '_', $string);
return $check === null ? 0 : mb_strlen($check, 'UTF-8');
}
else
return strlen(preg_replace('~' . $ent_list . '|.~u', '_', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string)));
{
$check = preg_replace('~' . $ent_list . '|.~u', '_', preg_replace_callback(self::$_entity_check_reg, 'entity_fix__callback', $string);
return $check === null ? 0 : strlen($check);
}
}
else
{
$ent_list = '&(#021|quot|amp|lt|gt|nbsp);';
return strlen(preg_replace('~' . $ent_list . '|.~u', '_', $string));
$check = preg_replace('~' . $ent_list . '|.~u', '_', $string);
return $check === null ? 0 : strlen($check);
}
}

Expand Down

0 comments on commit 5581830

Please sign in to comment.