|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21487 gethostbyname can resolve not existing hosts under Windows
Submitted: 2003-01-07 06:32 UTC Modified: 2003-01-27 22:33 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: corinl at gmx dot de Assigned:
Status: No Feedback Package: Network related
PHP Version: 4.3.0 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-01-07 06:32 UTC] corinl at gmx dot de

try this:
output is:

in fact, this domain doesn't exist, only exists. 
('host gmx.de5' on the server reports an error)
this behavior is bad when for example using getbyhostname to validate an email address, because an email send to someone@gmx.de5 would surely not arrive...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-07 06:51 UTC]
Just a note, I can not reproduce the problem under Linux/Unix.
 [2003-01-07 06:56 UTC]
With the following script:

$db = gethostbyname("gmx.de5");
$db = gethostbyname("");

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 from and not

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.

 [2003-01-07 09:48 UTC]
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
 [2003-01-27 22:33 UTC]
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.

 [2005-12-09 22:09 UTC] phpbugs at thequod dot de
I've just seen the same problem on PHP 4.3.10/win32: 
  $db = gethostbyname(""); 
  $db = gethostbyname("gmx.de5"); 
  $db = gethostbyname("gmx.de5."); 
string(14) "" 
string(12) "" 
string(12) "" 
I'm not the server admin, just troubleshooting it 
 [2005-12-09 22:15 UTC] phpbugs at thequod dot de
echo 'PHP '.phpversion()."\n"; 
$sdip = gethostbyname(""); 
$sddomain = gethostbyaddr($sdip); 
print "IP: $sdip\n"; 
print "Domain: $sddomain\n"; 
echo gethostbyname('')."\n"; 
echo gethostbyname('')."\n"; 
echo gethostbyname('')."\n"; 
echo gethostbyname('')."\n"; 
PHP 4.3.10 
All looks fine, exept the last two lines! It returns the 
server's IP address ( when an entry is not 
listed in
 [2005-12-09 22:23 UTC] phpbugs at thequod dot de
Using nslookup on the host.. 
Is this a DNS issue then? Or should PHP catch this as 
I've executed 
echo `nslookup`; 
and it outputs: 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jul 03 15:01:29 2020 UTC