Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.7

Request #18883 Consider upgrading to Net_DNS2
Submitted: 2011-09-29 10:12 UTC
From: doconnor Assigned: doconnor
Status: Assigned Package: Net_DNSBL (version 1.3.4)
PHP Version: 5.3.8 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2011-09-29 10:12 UTC] doconnor (Daniel O'Connor)

Comments

 [2011-10-07 23:52 UTC] nohn (Sebastian Nohn)
Here is a patch: Index: Net/DNSBL.php ===================================================== ============== --- Net/DNSBL.php (revision 317868) +++ Net/DNSBL.php (working copy) @@ -27,11 +27,11 @@ * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/Net_DNSBL - * @see Net_DNS + * @see Net_DNS2 * @since File available since Release 1.0.0 */ -require_once 'Net/DNS.php'; +require_once 'Net/DNS2.php'; /** * PEAR::Net_DNSBL @@ -216,14 +216,18 @@ public function isListed($host, $checkall = false) { $isListed = false; - $resolver = new Net_DNS_Resolver; + $resolver = new Net_DNS2_Resolver; if (!is_string($host)) { return false; } foreach ($this->blacklists as $blacklist) { - $response = $resolver->query($this->getHostForLookup($host, $blacklist)); + try { + $response = $resolver->query($this->getHostForLookup($host, $blacklist)); + } catch (Net_DNS2_Exception $e) { + $response = false; + } if ($response) { $isListed = true; if ($checkall) { @@ -285,9 +289,9 @@ { // Currently only works for v4 addresses. if (filter_var($host, FILTER_VALIDATE_IP)) { - $ip = $host; - } else { - $resolver = new Net_DNS_Resolver; + $ip = $host; + } else { + $resolver = new Net_DNS2_Resolver; $response = $resolver->query($host); $ip = isset($response->answer[0]->address)?$response->answer[0]- >address:NULL; } However, one of the Unit tests is failing. There seems a problem in TXT record handling of Net_DNS2, could you please take a look, Daniel?
 [2011-11-21 21:21 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: doconnor
I'll have a shot at this; and implementing a reset() method for Services_Trackback - http://test.pear.php.net:8080/job/Services_Trackback/lastCompletedBuild/testReport /(root)/Services_Trackback_SpamCheck_DNSBL_Test/test_reset/
 [2011-11-21 21:30 UTC] doconnor (Daniel O'Connor)
Applying the changes breaks lots of tests now :(
 [2011-12-05 10:53 UTC] mikepultz (Mike Pultz)
 [2011-12-05 10:55 UTC] mikepultz (Mike Pultz)
I added a patch file that updates Net_DNSBL to use Net_DNS2; it's pretty straight forward- I tested all your examples and they all worked fine after the patch. The errors you were getting likely where from the exceptions not being caught. Mike
 [2012-03-03 11:25 UTC] johnjohn (John LaRoche)
Is there any timeline on when/if this patch will be applied? I'm already using the Net_DNS2 package, and I don't really want to install the Net_DNS package- especially since it's deprecated now. Thanks- John
 [2012-04-01 20:23 UTC] doconnor (Daniel O'Connor)
File to patch: Net/DNSBL.php patching file Net/DNSBL.php Hunk #1 FAILED at 27. Hunk #2 succeeded at 216 (offset -1 lines). Hunk #3 succeeded at 240 (offset -1 lines). Hunk #4 succeeded at 263 (offset -1 lines). Hunk #5 FAILED at 304. 2 out of 5 hunks FAILED -- saving rejects to file Net/DNSBL.php.rej
 [2012-04-01 20:50 UTC] doconnor (Daniel O'Connor)
 [2012-04-01 20:52 UTC] doconnor (Daniel O'Connor)
-Assigned To: doconnor +Assigned To: nohn
All tests passing - the SURBL url appears dead, so I've pointed it at the waybackmachine
 [2012-04-20 10:40 UTC] nohn (Sebastian Nohn)
-Assigned To: nohn +Assigned To: doconnor
Tests still fail: test_unit: [exec] PHPUnit 3.5.5 by Sebastian Bergmann. [exec] [exec] ...................E [exec] [exec] Time: 50 seconds, Memory: 11.50Mb [exec] [exec] There was 1 error: [exec] [exec] 1) NetDNSBLSURBLTest::testInvalidArguments [exec] InvalidArgumentException: empty query string provided [exec] [exec] /usr/share/php/Net/DNS2/Packet/Request.php:116 [exec] /usr/share/php/Net/DNS2/Packet/Request.php:80 [exec] /usr/share/php/Net/DNS2/Resolver.php:118 [exec] /home/project/pear/Net_DNSBL/trunk/Net/DNSBL.php:231 [exec] /home/project/pear/Net_DNSBL/trunk/tests/NetDNSBLSURBLTest.php:158 [exec] [exec] FAILURES! [exec] Tests: 20, Assertions: 93, Errors: 1. [exec] [exec] Writing code coverage data to XML file, this may take a moment. [exec] [exec] Generating code coverage report, this may take a moment.
 [2012-04-20 18:40 UTC] doconnor (Daniel O'Connor)
@Sebastian - is that with the patch applied? http://test.pear.php.net:8080/job/Net_DNSBL/33/console vs http://test.pear.php.net:8080/job/Net_DNSBL/32/console shows that test unfortunately failing; but not in the way you describe?
 [2012-04-28 20:28 UTC] nohn (Sebastian Nohn)
It's without the patch. On my local machine the tests pass without the patch applied.