diff --git a/src/Decoder/Decoder.php b/src/Decoder/Decoder.php index e8d32fe..b003a5d 100644 --- a/src/Decoder/Decoder.php +++ b/src/Decoder/Decoder.php @@ -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])) { diff --git a/src/Records/Types/DomainName.php b/src/Records/Types/DomainName.php index fba3fbe..3117307 100644 --- a/src/Records/Types/DomainName.php +++ b/src/Records/Types/DomainName.php @@ -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;