Skip to content

Commit

Permalink
Fix deprecation warning (PHP 8.1+) (#39881)
Browse files Browse the repository at this point in the history
Fix deprecation warning with PHP 8.1+

If a replacement string is used, but no 'quicktask' is defined `$params->get('menu-quicktask')` will return `null` which is deprecated in PHP 8.1+.

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in administrator/components/com_menus/src/Helper/MenusHelper.php on line 894
  • Loading branch information
janschoenherr authored Feb 17, 2023
1 parent ac2658e commit 39061fa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ protected static function parseXmlNode($node, $replace = [])
$item->link = str_replace("{sql:$var}", $val, $item->link);
$item->class = str_replace("{sql:$var}", $val, $item->class);
$item->icon = str_replace("{sql:$var}", $val, $item->icon);
$params->set('menu-quicktask', str_replace("{sql:$var}", $val, $params->get('menu-quicktask')));
$params->set('menu-quicktask', str_replace("{sql:$var}", $val, $params->get('menu-quicktask', '')));
}

$item->setParams($params);
Expand Down

0 comments on commit 39061fa

Please sign in to comment.