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.
1 parent 51dccf8 commit 496d392Copy full SHA for 496d392
src/React/Dns/Resolver/Factory.php
@@ -46,6 +46,16 @@ protected function createCachedExecutor(LoopInterface $loop)
46
47
protected function addPortToServerIfMissing($nameserver)
48
{
49
- return false === strpos($nameserver, ':') ? "$nameserver:53" : $nameserver;
+ $colon = strrpos($nameserver, ':');
50
+
51
+ // there is no colon at all or the last one does not have a closing IPv6 bracket right before it
52
+ if ($colon === false || (strpos($nameserver, ':') !== $colon && strpos($nameserver, ']') !== ($colon - 1))) {
53
+ if (strpos($nameserver, ':') !== $colon) {
54
+ // several colons => enclose IPv6 address in square brackets
55
+ $nameserver = '[' . $nameserver . ']';
56
+ }
57
+ $nameserver .= ':53';
58
59
+ return $nameserver;
60
}
61
0 commit comments