From 711c3ae233bf13b4f9e73c6862919eb8ca64a4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Sat, 30 Aug 2025 19:24:31 +0200 Subject: [PATCH] fix: unpack() argument type --- src/Entity/DnsKey.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Entity/DnsKey.php b/src/Entity/DnsKey.php index b308252..82549b1 100644 --- a/src/Entity/DnsKey.php +++ b/src/Entity/DnsKey.php @@ -62,9 +62,15 @@ class DnsKey return $this; } - public function getKeyTag() + public function getKeyTag(): string { - return unpack('n', $this->keyTag)[1]; + $value = $this->keyTag; + + if (is_resource($value)) { + $value = stream_get_contents($value); + } + + return unpack('n', $value)[1]; } public function setKeyTag($keyTag): static @@ -86,9 +92,15 @@ class DnsKey return $this; } - public function getDigest() + public function getDigest(): string { - return strtoupper(bin2hex($this->digest)); + $value = $this->digest; + + if (is_resource($value)) { + $value = stream_get_contents($value); + } + + return strtoupper(bin2hex($value)); } public function setDigest($digest): static