PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_DNS » Bug #9268

send_tcp method doesn't receive all packets

Details

Submitted2006-11-08 13:26 UTC
Frompieter at prezent dot nl
Assignedfa
StatusClosed
PackageNet_DNS
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-11-08 13:26 UTC] pieter at prezent dot nl

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;