We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 49bb03f + 518e12e commit 849b847Copy full SHA for 849b847
1 file changed
Resolver/Factory.php
@@ -46,6 +46,15 @@ protected function createCachedExecutor(LoopInterface $loop)
46
47
protected function addPortToServerIfMissing($nameserver)
48
{
49
- return false === strpos($nameserver, ':') ? "$nameserver:53" : $nameserver;
+ if (strpos($nameserver, '[') === false && substr_count($nameserver, ':') >= 2) {
50
+ // several colons, but not enclosed in square brackets => enclose IPv6 address in square brackets
51
+ $nameserver = '[' . $nameserver . ']';
52
+ }
53
+ // assume a dummy scheme when checking for the port, otherwise parse_url() fails
54
+ if (parse_url('dummy://' . $nameserver, PHP_URL_PORT) === null) {
55
+ $nameserver .= ':53';
56
57
+
58
+ return $nameserver;
59
}
60
0 commit comments