diff --git a/.gitignore b/.gitignore index 210bf24..8bbb10c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ composer.lock phpunit.xml vendor .php_cs.cache +.phpunit.result.cache coverage diff --git a/lib/Rfc1035StubResolver.php b/lib/Rfc1035StubResolver.php index 24fcbba..a3d15be 100644 --- a/lib/Rfc1035StubResolver.php +++ b/lib/Rfc1035StubResolver.php @@ -187,7 +187,11 @@ final class Rfc1035StubResolver implements Resolver throw $reason; } - if ($searchIndex < \count($searchList) - 1 && \in_array($reason->getCode(), [2, 3], true)) { + if ($searchIndex < \count($searchList) - 1 && \in_array( + $reason->getCode(), + [2, 3], + true + )) { continue 2; } @@ -246,15 +250,19 @@ final class Rfc1035StubResolver implements Resolver } catch (ConfigException $e) { $this->configStatus = self::CONFIG_FAILED; + $message = "Could not load the system's DNS configuration; " + . "falling back to synchronous, blocking resolver; " + . \get_class($e) . ": " . $e->getMessage(); + try { \trigger_error( - "Could not load the system's DNS configuration, using synchronous, blocking fallback", + $message, \E_USER_WARNING ); } catch (\Throwable $triggerException) { \set_error_handler(null); \trigger_error( - "Could not load the system's DNS configuration, using synchronous, blocking fallback", + $message, \E_USER_WARNING ); \restore_error_handler();