Bug #17476 [Opn]: [test.com] Undefined index: server
| From: | ken at linux dot ie | Date: | Wed, 09 Jun 2010 13:52:33 +0000 |
| Subject: | Bug #17476 [Opn]: [test.com] Undefined index: server | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-3903@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=17476&edit=1
ID: 17476
Updated by: ken@linux.ie
Reported By: hm2k at php dot net
Summary: [test.com] Undefined index: server
Status: Open
Type: Bug
Package: Net_Whois
Package Version: SVN
PHP Version: 5.3.2
-Assigned To:
+Assigned To: kguest
Roadmap Versions:
New Comment:
-Assigned To:
+Assigned To: kguest
Previous Comments:
------------------------------------------------------------------------
[2010-06-09 13:13:47] hm2k
Added #patch
bug:17476;patch:authoritative-server-fix;revision:1276089227;.
------------------------------------------------------------------------
[2010-06-09 13:12:55] hm2k
Description:
------------
The current version of Net_Whois is returning errors when it can't
parse the "setAuthoritative" whois server.
The script has a few issues:
1. The whois server parsing was messy, I'm surprised it even worked.
2. The script used "=$domain", instead of 'domain '.$domain which
returns less data for parsing.
3. There was an extra unnecessary connection.
I've fixed these issues.
Diff patch included.
Test script:
---------------
<?php
$q=isset($_REQUEST['q'])?htmlspecialchars($_REQUEST['q']):NULL;
$s=isset($_REQUEST['s'])?htmlspecialchars($_REQUEST['s']):NULL;
if (strchr($q,'.')) {
require_once 'Net_Whois.php';
$whois = new Net_Whois;
$q=strtolower($q);
if (!$s && $q[0] == '.') { $s='whois.iana.org'; }
$q=trim($q,'.');
$tld=pathinfo($q,PATHINFO_EXTENSION);
if ($tld=='com') {$whois->setAuthoritative(1);}
elseif ($tld=='name') {$q='domain = '.$q;}
$data=htmlspecialchars($whois->query($q,$s));
echo "<pre>$data</pre>";
}
?>
Expected result:
----------------
[whois record for test.com]
Actual result:
--------------
Notice: Undefined property: Net_Whois::$timeout in
/home/.../Net_Whois.php on line 313
Notice: Undefined index: server in /home/.../Net_Whois.php on line 199
Notice: Undefined index: server in /home/.../Net_Whois.php on line 200
Notice: Undefined property: Net_Whois::$timeout in
/home/.../Net_Whois.php on line 313
Unable to open socket
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=17476&edit=1