mirror of
https://github.com/danog/dns.git
synced 2024-11-26 20:14:51 +01:00
Remove error suppression from calls to inet_pton()
This commit is contained in:
parent
28383c051f
commit
12a4b46ba7
@ -169,7 +169,7 @@ final class DnsConfig
|
||||
$addr = \trim($addr, "[]");
|
||||
$port = (int) $port;
|
||||
|
||||
if (!@\inet_pton($addr)) {
|
||||
if (!\inet_pton($addr)) {
|
||||
throw new DnsConfigException("Invalid server IP: $addr");
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ final class HostLoader
|
||||
|
||||
$parts = \preg_split('/\s+/', $line);
|
||||
|
||||
if (!($ip = @\inet_pton($parts[0]))) {
|
||||
if (!($ip = \inet_pton($parts[0]))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ final class Rfc1035StubDnsResolver implements DnsResolver
|
||||
private function normalizeName(string $name, int $type): string
|
||||
{
|
||||
if ($type === DnsRecord::PTR) {
|
||||
if (($packedIp = @\inet_pton($name)) !== false) {
|
||||
if (($packedIp = \inet_pton($name)) !== false) {
|
||||
if (isset($packedIp[4])) { // IPv6
|
||||
$name = \wordwrap(\strrev(\bin2hex($packedIp)), 1, ".", true) . ".ip6.arpa";
|
||||
} else { // IPv4
|
||||
|
@ -71,7 +71,7 @@ final class UnixDnsConfigLoader implements DnsConfigLoader
|
||||
}
|
||||
|
||||
$value = \trim($value);
|
||||
$ip = @\inet_pton($value);
|
||||
$ip = \inet_pton($value);
|
||||
if ($ip === false) {
|
||||
continue;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ final class WindowsDnsConfigLoader implements DnsConfigLoader
|
||||
// Microsoft documents space as delimiter, AppVeyor uses comma, we just accept both
|
||||
foreach (\explode(" ", \strtr($nameserver, ",", " ")) as $nameserver) {
|
||||
$nameserver = \trim($nameserver);
|
||||
$ip = @\inet_pton($nameserver);
|
||||
$ip = \inet_pton($nameserver);
|
||||
|
||||
if ($ip === false) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user