#21487 [Com]: gethostbyname can resolve not existing hosts under Windows

From: Date: Fri, 09 Dec 2005 21:23:27 +0000
Subject: #21487 [Com]: gethostbyname can resolve not existing hosts under Windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90181@lists.php.net to get a copy of this message
 ID:               21487
 Comment by:       phpbugs at thequod dot de
 Reported By:      corinl at gmx dot de
 Status:           No Feedback
 Bug Type:         Network related
 Operating System: Windows
 PHP Version:      4.3.0
 New Comment:

Using nslookup on the host.. 
 
Is this a DNS issue then? Or should PHP catch this as 
"non-existing"? 
 
I've executed 
<?php 
echo nslookup 150.250.35.66.list.dsbl.org; 
?> 
and it outputs: 
Name:    150.250.35.66.list.dsbl.org.happilyhosted.com 
Address:  216.82.79.97


Previous Comments:
------------------------------------------------------------------------

[2005-12-09 22:15:43] phpbugs at thequod dot de

<?php 
echo 'PHP '.phpversion()."\n"; 
$sdip = gethostbyname("slashdot.org"); 
$sddomain = gethostbyaddr($sdip); 
print "IP: $sdip\n"; 
print "Domain: $sddomain\n"; 
 
echo gethostbyname('totallyfake456jh47r.com')."\n"; 
echo gethostbyname('2.0.0.127.list.dsbl.org')."\n"; 
echo gethostbyname('972.79.82.216.list.dsbl.org')."\n"; 
echo gethostbyname('150.250.35.66.list.dsbl.org')."\n"; 
?> 
 
returns: 
 
PHP 4.3.10 
IP: 66.35.250.150 
Domain: slashdot.org 
totallyfake456jh47r.com 
127.0.0.2 
216.82.79.97 
216.82.79.97 
 
All looks fine, exept the last two lines! It returns the 
server's IP address (216.82.79.97) when an entry is not 
listed in dsbl.org.

------------------------------------------------------------------------

[2005-12-09 22:09:45] phpbugs at thequod dot de

I've just seen the same problem on PHP 4.3.10/win32: 
 
<?php 
  $db = gethostbyname("gmx.de"); 
  var_dump($db); 
  $db = gethostbyname("gmx.de5"); 
  var_dump($db); 
  $db = gethostbyname("gmx.de5."); 
  var_dump($db); 
?> 
 
returns 
 
string(14) "213.165.64.215" 
string(12) "216.82.79.97" 
string(12) "216.82.79.97" 
 
I'm not the server admin, just troubleshooting it 
remotely.

------------------------------------------------------------------------

[2003-01-27 22:33:18] sniper@php.net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.



------------------------------------------------------------------------

[2003-01-07 09:48:43] pollita@php.net

It's possible that your DNS is setup with a search domain that has a
wildcard.  I'd like you to try two things:

1) gethostbyname("gms.de5.");  <--- does that return an IP address as
well? (Note the trailing dot)

2) Check your TCP/IP Properties | Advanced Settings | DNS Tab |
describe every single piece of information on this property sheet, give
detail.

Interrestingly there doesn't seem to be a revese lookup for
62.75.134.200...

------------------------------------------------------------------------

[2003-01-07 06:56:17] nicos@php.net

With the following script:

<?php
$db = gethostbyname("gmx.de5");
var_dump($db);
$db = gethostbyname("gmx.de");
var_dump($db);
?>

Edin can't reproduce the problem under windows.

Can you please try that script? You're saying that host gmx.de5 on the
server reports an error but you're under windows and windows doesn't
have 'host'... Are you sure your DNS is working fine? I'm getting
213.165.65.100 from gmx.de and not 62.75.134.200...

gethostbyname() is also supposed to return the hostname on failure. At
least thats what we (Edin and me) are getting under Windows and
Linux/Unix.

Thank you for your report.


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/21487

-- 
Edit this bug report at http://bugs.php.net/?id=21487&edit=1



Thread (8 messages)

« previous php.bugs (#90181) next »