Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit fd3d550

Browse files
Skip further checks in case of empty domain part
Fixes issue #240
1 parent 87e743d commit fd3d550

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Hostname.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,13 @@ public function isValid($value)
20982098
return false;
20992099
}
21002100
}
2101+
2102+
// Stop with following checks if domain part is empty, as it definitely is not a valid hostname then
2103+
if ($domainPart === '') {
2104+
$this->error(self::INVALID_HOSTNAME);
2105+
$status = false;
2106+
break 2;
2107+
}
21012108

21022109
// Check dash (-) does not start, end or appear in 3rd and 4th positions
21032110
if ($utf8StrWrapper->strpos($domainPart, '-') === 0

0 commit comments

Comments
 (0)