Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
Allows records to have an empty domain name.
  • Loading branch information
trowski committed Jan 9, 2018
1 parent 67de549 commit c37d286
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/Decoder/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,6 @@ private function decodeDomainName(DecodingContext $decodingContext, DomainName $
}
}

if (!$labels) {
throw new \UnexpectedValueException('Decode error: Empty domain name at position ' . $startIndex);
}

$result = [];
foreach ($labels as $label) {
if (is_int($label[0])) {
Expand Down
4 changes: 3 additions & 1 deletion src/Records/Types/DomainName.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function getLabels($tldFirst = false)
public function setLabels(array $labels, $tldFirst = false)
{
if (!$labels) {
throw new \InvalidArgumentException('Label list is not a valid domain name: List is empty');
$this->labels = [];
$this->value = '';
return;
}

$length = $count = 0;
Expand Down

0 comments on commit c37d286

Please sign in to comment.