PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_DNS » Bug #3132

[Patch] - bug fixes additional porting from Perl

Details

Submitted2005-01-07 16:35 UTC
Fromm dot reidenbach at everytruckjob dot com
Assignedcox
StatusClosed
PackageNet_DNS
PHP Version5.0.3
OSlinux
Roadmaps(Not assigned)

Comments

[2005-01-07 16:35 UTC] m dot reidenbach at everytruckjob dot com

Description:
------------
Please review the linked patch. The patch provides several fixes and improvements which are listed below. It also fixes bug ids 678, 1871, and 2141. Note that I did not touch the send_tcp or send_udp_no_sock_lib functions and these paths may still exhibit bugs with php5.

Can now query FQDNs that end in a dot (bug 678).

Works with php5 by not reassigning $this and using a variable to hold the subclass instead (bug 1871).

Net_DNS_RR_MX will now return a result even if the preference is 0 (bug 2141).

Uses array_key_exists instead of checking to see if a non-existent key's strlen is 0.

The Net_DNS_Resolver::send_udp_with_sock_lib function now sends the query to all the resolvers DNS servers and then checks to see if any answered. It also retries until the timeout period is reached or the retrans count is reached rather than returning after the first unsuccessful attempt
(ported from PERL). Before these changes, only the first nameserver was sent the query which resulted in the function returning null if one of two servers were temporarily down instead of the correct response from the 2nd server if it was up.

Can now pass an array to Net_DNS_Resolver to change the default resolver options like you can with Perl's Net::DNS package.

Net_DNS_Resolver::nextid works with register globals off

You can now set the nameservers to query using Net_DNS_Resolver::nameservers(). This was not functioning before due to testing $ns when the function parameter is $nsa.

You can now set nameservers using a FQDN instead of having to use ip addresses. The FQDNs are looked up using the system's default resolver. (This was ported from PERL's Net::DNS and was marked as needing to be ported in the function comments)

Net_DNS_Resolver::cname_addr() was ported from PERL and now returns the address for A and CNAME records. This is needed for Net_DNS_Resolver::nameservers() to function properly.

A "." was added to "in-addr.arpa" in Net_DNS_Resolver::search() to match PERL

Whitespace fixes.

Reproduce code:
---------------
http://www.tuscaloosadesigncompany.com/Net_DNS.diff

[2005-04-08 16:16 UTC] cox at idecnet dot com

I've commited that suggestions/fixes into CVS. Feel free to verify that all works as expected.

Thanks a lot!

Tomas V.V.Cox

[2005-04-08 17:03 UTC] m dot reidenbach at everytruckjob dot com

I believe there is still one spot where a . should be added to in-addr.arpa

--- Resolver.php 2005-04-08 12:00:33.000000000 -0500
+++ Resolver-new.php 2005-04-08 12:03:01.000000000 -0500
@@ -616,7 +616,7 @@
* PTR query.
*/
if (preg_match('/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/', $name, $regs)) {
- $name = "$regs[4].$regs[3].$regs[2].$regs[1].in-addr.arpa";
+ $name = "{$regs[4]}.{$regs[3]}.{$regs[2]}.{$regs[1]}.in-addr.arpa.";
$type = 'PTR';
}