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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!