]> git.mxchange.org Git - friendica.git/commitdiff
Remove useless call to gethostbyname()
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 25 Jul 2023 13:37:33 +0000 (15:37 +0200)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 25 Jul 2023 13:37:33 +0000 (15:37 +0200)
- This function doesn't return a falsy value even when no IP address was able to be retrieved for the given host name
- Address https://github.com/friendica/friendica/issues/13157#issuecomment-1638505285

src/Network/HTTPClient/Client/HttpClient.php

index f47418060c16d34c93bd51bd2f85cc80d5a321b1..d608774eca377463c707b6a7ed0bb0c049638870 100644 (file)
@@ -73,7 +73,7 @@ class HttpClient implements ICanSendHttpRequests
                        throw new \InvalidArgumentException('Unable to retrieve the host in URL: ' . $url);
                }
 
-               if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA) && !gethostbyname($host)) {
+               if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA)) {
                        $this->logger->debug('URL cannot be resolved.', ['url' => $url, 'callstack' => System::callstack(20)]);
                        $this->profiler->stopRecording();
                        return CurlResult::createErrorCurl($this->logger, $url);