Skip to content

Commit

Permalink
php8 deprecation str_replace Passing null to param
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil E. Taylor authored Dec 24, 2021
1 parent d55ab7f commit 728e5e0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libraries/src/User/UserHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,15 @@ public static function getShortHashedUserAgent()
$ua = \JFactory::getApplication()->client;
$uaString = $ua->userAgent;
$browserVersion = $ua->browserVersion;
$uaShort = str_replace($browserVersion, 'abcd', $uaString);

if ($browserVersion)
{
$uaShort = str_replace($browserVersion, 'abcd', $uaString);
}
else
{
$uaShort = $uaString;
}

return md5(\JUri::base() . $uaShort);
}
Expand Down

0 comments on commit 728e5e0

Please sign in to comment.