Skip to content

Commit c37d286

Browse files
committed
Fix #6
Allows records to have an empty domain name.
1 parent 67de549 commit c37d286

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Decoder/Decoder.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,6 @@ private function decodeDomainName(DecodingContext $decodingContext, DomainName $
259259
}
260260
}
261261

262-
if (!$labels) {
263-
throw new \UnexpectedValueException('Decode error: Empty domain name at position ' . $startIndex);
264-
}
265-
266262
$result = [];
267263
foreach ($labels as $label) {
268264
if (is_int($label[0])) {

src/Records/Types/DomainName.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public function getLabels($tldFirst = false)
8383
public function setLabels(array $labels, $tldFirst = false)
8484
{
8585
if (!$labels) {
86-
throw new \InvalidArgumentException('Label list is not a valid domain name: List is empty');
86+
$this->labels = [];
87+
$this->value = '';
88+
return;
8789
}
8890

8991
$length = $count = 0;

0 commit comments

Comments
 (0)