Skip to content

Commit 928f606

Browse files
committed
added test for is_array unpacking answer header
1 parent d9009df commit 928f606

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/PurplePixie/PhpDns/DNSQuery.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ private function readRecord(): array
200200

201201
$ans_header = unpack('ntype/nclass/Nttl/nlength', $ans_header_bin);
202202

203-
$this->debug(
203+
if (is_array($ans_header)) $this->debug(
204204
'Record Type ' . $ans_header['type'] . ' Class ' . $ans_header['class'] .
205205
' TTL ' . $ans_header['ttl'] . ' Length ' . $ans_header['length']
206206
);
207+
else $this->debug("Error unpacking answer header, no array returned.");
207208

208209
$typeId = $ans_header['type'];
209210

0 commit comments

Comments
 (0)