Skip to content

Commit

Permalink
Resolve Deprecated Functionality: preg_split(): Passing null to param…
Browse files Browse the repository at this point in the history
…eter #2 ($subject) while using PHP 8.0+

In new versions of PHP (8.*) the Second Parameter subject can't be null so if the $ranges is null then this will through exception : `Exception #0 (Exception): Deprecated Functionality: preg_split(): Passing null to parameter #2 ($subject).....`. That crash the code flow. So by this commit solved the problem.
  • Loading branch information
Abdul-Majid10 authored Feb 10, 2023
1 parent ab857a4 commit 3fa6fee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function isIpMatched($ip, array $ranges)
*/
public function getAllowedRanges()
{
$ranges = $this->scopeConfig->getValue(self::XML_PATH_GENERAL_AUTHORIZED_IPS);
$ranges = $this->scopeConfig->getValue(self::XML_PATH_GENERAL_AUTHORIZED_IPS) ?? "";
return preg_split('/\s*[,;]+\s*/', $ranges);
}

Expand Down

0 comments on commit 3fa6fee

Please sign in to comment.