-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello, I don't have an example that trigger the error at 100% chance, but it's linked to a preceding issue #29. And that's why I missed this check.
In DNSQuery.php:209, $typeId can be null :
$typeId = $ans_header['type'];
Then it throws an error at DnsQuery.php:355 :
'typename' => $this->types->getNameById($typeId),
because getNameById() ask for a non-nullable string.
This one is linked to the bug with the debug and the array that was a boolean (DNSQuery.php:209). If you remember the debug was calling $ans_header['type'] when it is a boolean. But in fact $ans_header['type'] is called a second time, so the same error happens. That's why it's linked with the error error at DNSQuery.php:355.
So both errors should be fixed to fully resolve this bug. Why it happens ? I don't have a better answer than this thread at stackoverflow :
Turns out that the warning appears when the input data is not correct, specifically if it expects more characters to unpack than the provided amount, in this case the unpack() function evaluates to false.
Have a good day :)