From 5937c4d309102a286500deab9948e5cb029e9645 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 22 Aug 2019 22:48:52 +0200 Subject: [PATCH] Fixes --- lib/NativeDecoder.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/NativeDecoder.php b/lib/NativeDecoder.php index 29b30ee..9919a8c 100644 --- a/lib/NativeDecoder.php +++ b/lib/NativeDecoder.php @@ -97,10 +97,7 @@ class NativeDecoder { /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); - $labels = \explode('.', $name); - if ('' !== $last = \array_pop($labels)) { - $labels[] = $last; - } + $labels = \explode('.', rtrim($name, '.')); $domainName->setLabels($labels); $question = $this->questionFactory->create($type); @@ -190,10 +187,7 @@ class NativeDecoder if (!$encodingContext->isTruncated()) { /** @var \LibDNS\Records\Types\DomainName $domainName */ $domainName = $this->typeBuilder->build(Types::DOMAIN_NAME); - $labels = \explode('.', $record['host']); - if ('' !== $last = \array_pop($labels)) { - $labels[] = $last; - } + $labels = \explode('.', rtrim($record['host'], '.')); $domainName->setLabels($labels); $packet = $encodingContext->getPacket();