Skip to content

Commit 927e67b

Browse files
committed
Treat false return value from dns_get_record
1 parent ee3481e commit 927e67b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ public function validateActiveUrl($attribute, $value)
117117

118118
if ($url = parse_url($value, PHP_URL_HOST)) {
119119
try {
120-
return count($this->dnsRecords($url.'.', DNS_A | DNS_AAAA)) > 0;
120+
$records = $this->dnsRecords($url.'.', DNS_A | DNS_AAAA);
121+
if (is_array($records) && count($records) > 0) {
122+
return true;
123+
}
121124
} catch (Exception $e) {
122125
return false;
123126
}

tests/Validation/ValidationValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3557,7 +3557,7 @@ public function activeUrlDataProvider()
35573557
['x' => 'http://www.google.com'],
35583558
true,
35593559
],
3560-
'Google About With Subdomain' => [
3560+
'Google With Subdomain About Page' => [
35613561
['x' => 'http://www.google.com/about'],
35623562
true,
35633563
],

0 commit comments

Comments
 (0)