tcpclient : generate an exception if the DNS has an error

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4037 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-01-19 10:54:10 +00:00
parent 6de459a4c6
commit 8c0f10d9d9

View File

@@ -56,7 +56,10 @@ class tcpclient
$i = 0;
while (empty ($this->ipv4) && empty ($this->ipv6) && $i < 10)
{
$nsRecords = dns_get_record ($ipOrName, DNS_AAAA + DNS_A + DNS_CNAME);
$nsRecords = @dns_get_record ($ipOrName, DNS_AAAA + DNS_A + DNS_CNAME);
if ($nsRecords === false)
throw new \Exception ("Can not find the IP for $ipOrName : ".
"DNS Error", 500);
foreach ($nsRecords as $val)
{
if ($val["type"] === "CNAME")