Net_DNS2
pear.php.net
PHP5 Resolver library used to communicate with a DNS server.
Provides (roughly) the same functionality as Net_DNS, but using PHP5 objects, exceptions for error handling, better sockets support.

This release is (in most cases) 2x - 10x faster than Net_DNS, as well as includes more RR's (including DNSSEC RR's), and improved sockets and streams support.
Mike Pultz
mikepultz
mike@mikepultz.com yes
2015-04-13
00:55:09
1.4.1
1.4.1
stable
stable
BSD License
- increased the default DNSSEC payload size value to 4000 bytes per RFC 4035 section 4.1; this is still configurable. - fixed a bug where I was still using the DNS_MAX_UDP_SIZE default (512 bytes) for all requests, event DNSSEC, where I should have been using the dnssec_payload_size config value. - removed the limitation that PTR records had to look like IP addresses; you can add other things to PTR records, like service discovery objects- RFC 6763. - dropped support for using the Sockets library on Windows. There have been too many inconsistencies between versions of Windows; we'll just default to use the Streams library. - fixed the Net_DNS2_RR_PTR class so we can pass ptrdname's with spaces in them so that we can support DNS-Based Service Discovery (RFC 6763). - added support for the CSYNC resource record - see RFC 7477.
5.1.2
1.4.0a12
0.6.0
0.6.0
beta
beta
2010-09-26
BSD License
Initial Beta release of Net_DNS2
1.0.0
1.0.0
stable
beta
2010-10-25
BSD License
- finished support for the OPT, APL, and the HIP RR - fixed a small bug in the Net_DNS2_RR::fromString method when parsing strings. apparently PHP doesn't think that 0 is numeric sometimes - updated the @since value for all the files; it was set with the incorrect version.
1.0.1
1.0.1
stable
stable
2010-12-02
BSD License
- fixed a problem Sockets and Streams class; was using the wrong shift operators when calculating the size - added support for the WKS RR - fixed some phpcs issues
1.1.0
1.1.0
stable
stable
2011-04-24
BSD License
- added support for signing requests using SIG(0); uses the PHP openssl extension, and only currently supports RSA- DSA support in PHP is limited. - moved the signing code for SIG(0) and TSIG to the base class so it can be used for both updates and queries (for AXFR) - added a simple local cache feature using shared memory (shmop extension) or using a flat fille. This feature is disabled by default. - added support for the ATMA resource record (supported in Windows)
1.1.1
1.1.1
stable
stable
2011-05-07
BSD License
- fixed a bug in the autoload function; if you had another autoload function defined, and tried to load a class with an _ in the name, it would fail.
1.1.2
1.1.2
stable
stable
2011-06-01
BSD License
- fixed a bug in the Net_DNS2_Updater class; I wasn't resetting the internal packet request values, so in some cases making more than one request on the same instance would fail. - Fixed a bug in Net_DNS2; I wasn't handling comments properly when parsing the resolv.conf file. - check for duplicate entries when adding/deleting entries in the Updater() class; BIND will throw and error if you try to delete the same RR twice in the same request, not sure if this is expected behaviour - modified several RR's to clean up the trailing period when it's displayed on hosts.
1.1.3
1.1.3
stable
stable
2011-07-01
BSD License
- added support for IPv6 DNS servers; from resolv.conf files, and from name server arrays - added new IPv4 and IPv6 validation functions, and a IPv6 expand function - changed the A, AAAA and IPSECKEY RR's to use the new validation methods - added support for IPv6 PTR records - dropped the old IPv4 regex from the lookups class
1.1.4
1.1.4
stable
stable
2011-07-25
BSD License
- fixed a math issue with the name compress logic; this would somtimes screw up Updates with multiple RR's - added a new test in the test suite, that validates that the domain name compression and expansion works properly
1.2.0
1.2.0
stable
stable
2011-12-04
BSD License
- added numeric error codes to the Lookups class, and had each method that throws an exception throw a numeric error code along with the message. - dropped all references to InvalidArgumentException; we only use the Net_DNS2_Exception from now on. - added the CAA, URI, TALINK, CDS and TA resource records. Some of these are experimental, but are pretty straight forward. - fixed a bug in formatString(); my version was only putting double quotes around strings that have spaces, but apparently ALL strings should have double quotes around them. This is how BIND does it. - re-organized the Net_DNS2_Lookups initialization code; it no longer creates a global object of itself. - fixed a bug in the caching code; in some cases it wouldn't cache the same content more than once. - added an option to use JSON to serialize the cache data rather than using the PHP serialize function. JSON is much faster, but loses the class definition, and becomes a stdClass object. - fixed a handful of cases where I was using double quotes where a single quote would be fine.
1.2.1
1.2.1
stable
stable
2012-03-24
BSD License
- changed the Net_DNS2_Sockets::_sock property from private to protected; this was causing some problems when the request was failing. - PHP doesn't support unsigned integers, but many of the RR's return unsigned values (like SOA), so there is the possibility that the value will overrun on 32bit systems, and you'll end up with a negative value. So a new function was added to convert the negative value, to a string with the correct unsigned value.
1.2.2
1.2.2
stable
stable
2012-08-13
BSD License
- added some trimming of whitespace to Net_DNS2_RR::buildString(); we'd get some Uninitialized string offset errors if there was some blank space at the end. - fixed a few cases where Net_DNS2_Lookup where it should Net_DNS2_Lookups - added support for a strict query mode, that lets you handle the weird way DNS handles failed lookups + CNAME recors; see RFC 1034 section 3.6.2 for more information. - fixed some warning messages that were coming from the cache classes when a json_decode() would fail. - fixed a bug in Net_DNS2_Cache_File and Net_DNS2_Cache_Shm; it would try to write the file even if caching was turned off - made sure we don't cache records when we do a zone transfer - added some blocking in both the Sockets.php and Streams.php file around the read function - I wasn't handling multi-message zone transfers properly; now we loop through and read all the messages and pack them together as one big result
1.2.3
1.2.3
stable
stable
2012-08-17
BSD License
- added a LICENSE file to satisfy fedora packaging guidelines - included the tests folder in the PEAR package - updated the tests to not include a specific include_path, and to use the Google public DNS servers for the resolution tests, rather than the /etc/resolv.conf file (which won't exist on a Windows system) - fixed a endless loop bug in the Streams.php file; this was related to the code changes I made + UDP packets
1.2.4
1.2.4
stable
stable
2012-09-19
BSD License
- added the name server that the response came from to the Net_DNS2_Packet_Response object - added the socket type (TCP or UDP) that was used for the request. - changed the internal socket logic to use a local define for SOCK_STREAM and SOCK_DGRAM rather than the one provied with the sockets library; this isn't available if you're not using the library. - fixed a bug when an AXFR fails; rather than returning right away, it was waiting until there was a timeout condition. Now it returns right away on failure.
1.2.5
1.2.5
stable
stable
2012-12-30
BSD License
- changed the socket_connect() code to start off non-blocking, and call select() after connect() so a timeout on a invalid server works properly - added the new TLSA RR - RFC 6698 - fixed the socket defines again; apparently the values of the SOCK_* are different under solaris - changed the Net_DNS2_Updater::update() so you can pass a reference to a variable that will be populated with the response object - moved the lines that add the response server/type to after the is_null() check- it should have been there to begin with. - fixed a whole bunch of cases where I wasn't incrementing the offset values properly - added support to set the RD (recursion desired) bit when making a request
1.3.0
1.3.0
stable
stable
2013-04-07
BSD License
- re-worked a lot of the code around OPT RR's, including adding support for the DO flag - added the AD and CD flags to the Net_DNS2_Header class for DNSSEC - added a new function to keep track of RR's that should NOT be cached. - added a new flag (dnssec) to request DNSSEC lookups; this adds an OPT RR to the additional section - added a new flag (dnssec_payload_size) to adjust the EDNS(0) UDP payload size. - added a new flag (dnssec_cd_flag) to set the DNSSEC CD bit to disable signature validation. - added a new flag (dnssec_ad_flag) to set the DNSSEC AD bit to request authentic data without needing to set the DO flag. - fixed an issue in Net_DNS2_Socket_Sockets; Windows (specifically < 2003) has problems with MSG_WAITALL - added a DNSSEC test to the testing suite.
1.3.1
1.3.1
stable
stable
2013-06-12
BSD License
- added the Net_DNS2_Packet_Request and Net_DNS2_Packet_Response objects to the Net_DNS2_Exception object - added support in the TSIG class for SHA algorithms (requires the hash extension, which is included in PHP >= 5.1.2), patch provided by Manuel Mausz - added support for the NID, L32, L64, and LP DNS RR's (RFC6742) - lots of phpcs cleanup
1.3.2
1.3.2
stable
stable
2013-11-30
BSD License
- added support for the EUI48 and EUI64 resource records (RFC7043) - fixed how we handle the return values from socket select() statements; this wasn't causing a problem, but it wasn't quite right - added some error messaging when the socket times out - before we cache the data, unset the rdata value; this was causing some JSON errors to be generated, and we don't need the data anyway.
1.4.1
1.4.1
stable
stable
2015-04-12
BSD License
- increased the default DNSSEC payload size value to 4000 bytes per RFC 4035 section 4.1; this is still configurable. - fixed a bug where I was still using the DNS_MAX_UDP_SIZE default (512 bytes) for all requests, event DNSSEC, where I should have been using the dnssec_payload_size config value. - removed the limitation that PTR records had to look like IP addresses; you can add other things to PTR records, like service discovery objects- RFC 6763. - dropped support for using the Sockets library on Windows. There have been too many inconsistencies between versions of Windows; we'll just default to use the Streams library. - fixed the Net_DNS2_RR_PTR class so we can pass ptrdname's with spaces in them so that we can support DNS-Based Service Discovery (RFC 6763). - added support for the CSYNC resource record - see RFC 7477.