Skip to content

Commit

Permalink
PropertyModifierGetHostByName: Fix inet_pton unrecognized address e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
raviks789 committed Aug 8, 2024
1 parent 428a49f commit 6d5df37
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ public function transform($value)
}

$host = gethostbyname($value);
$inAddr = inet_pton($host);

// Workaround for "inet_pton: unrecognized address" error in PHP 7.2
if ($host !== $value) {
$inAddr = inet_pton($host);
} else {
$inAddr = false;
}

if (! $inAddr || strlen($inAddr) !== 4) {
switch ($this->getSetting('on_failure')) {
case 'null':
Expand Down

0 comments on commit 6d5df37

Please sign in to comment.