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  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 11 - 1 = ?

 
 [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.