PropertyModifierGetHostByName: Fix `inet_pton` unrecognized address error

This commit is contained in:
raviks789 2024-08-06 13:46:14 +02:00 committed by Eric Lippmann
parent aaf51452be
commit 6c7918033d
1 changed files with 8 additions and 1 deletions

View File

@ -34,7 +34,14 @@ class PropertyModifierGetHostByName extends PropertyModifierHook
}
$host = gethostbyname($value);
// 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':