Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.7

Bug #9268 send_tcp method doesn't receive all packets
Submitted: 2006-11-08 13:26 UTC
From: pieter at prezent dot nl Assigned: fa
Status: Closed Package: Net_DNS (version 1.0.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-08 13:26 UTC] pieter at prezent dot nl (Pieter)
Description: ------------ In the method send_tcp, two freads are used to read in the data. If the response of the DNS server is bigger than two packets (for example for zone transfers of large zones), not everything is read, which results in an error. This is because fread() stops reading when a new packet is received, see php manual. This is a patch: --- DNS/Resolver.php.orig 2006-11-08 14:01:13.000000000 +0100 +++ DNS/Resolver.php 2006-11-08 14:15:25.000000000 +0100 @@ -787,7 +787,10 @@ if (!$len) { continue; } - $buf = fread($sock, $len); + $buf = ''; + while (!feof($sock) && (strlen($buf) < $len) ) { + $buf .= fread($sock, $len-strlen($buf)); + } $actual = strlen($buf); $this->answerfrom = $ns; $this->answersize = $len;

Comments

 [2007-07-03 21:14 UTC] fa (Florian Anderiasch)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.