diff --git a/composer.json b/composer.json index 5a43ed92..b3fdc636 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "require": { "php": ">=5.3.0", "evenement/evenement": "^3.0 || ^2.0 || ^1.0", - "react/dns": "^1.1", + "react/dns": "^1.7", "react/event-loop": "^1.0 || ^0.5", "react/promise": "^2.6.0 || ^1.2.1", "react/promise-timer": "^1.4.0", diff --git a/src/Connector.php b/src/Connector.php index 0225f0fb..914c6a98 100644 --- a/src/Connector.php +++ b/src/Connector.php @@ -57,16 +57,18 @@ public function __construct(LoopInterface $loop, array $options = array()) $resolver = $options['dns']; } else { if ($options['dns'] !== true) { - $server = $options['dns']; + $config = $options['dns']; } else { // try to load nameservers from system config or default to Google's public DNS $config = DnsConfig::loadSystemConfigBlocking(); - $server = $config->nameservers ? \reset($config->nameservers) : '8.8.8.8'; + if (!$config->nameservers) { + $config->nameservers[] = '8.8.8.8'; // @codeCoverageIgnore + } } $factory = new DnsFactory(); $resolver = $factory->createCached( - $server, + $config, $loop ); }