Skip to content

Commit

Permalink
handle getAdyenIpAddresses hostname cannot be resolved case (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyattilakiss authored and peterojo committed May 3, 2021
1 parent 0eea1e8 commit c87e80b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Adyen/Util/IpAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ public function getAdyenIpAddresses()
{
$ipAddresses = array();
foreach (self::$HOSTNAMES as $hostname) {
$ipAddresses = array_merge($ipAddresses, gethostbynamel($hostname));
$ipAddressesOfHostName = gethostbynamel($hostname);

// gethostbynamel can return false if hostname could not be resolved
if (false !== $ipAddressesOfHostName) {
$ipAddresses = array_merge($ipAddresses, $ipAddressesOfHostName);
}
}
return $ipAddresses;
}
Expand Down

0 comments on commit c87e80b

Please sign in to comment.