Bug #1894 Updated: gethostbyname returns "255.255.255.255"
| From: | sander@php.net | Date: | Sun, 16 Jun 2002 12:35:14 +0000 |
| Subject: | Bug #1894 Updated: gethostbyname returns "255.255.255.255" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10655@lists.php.net to get a copy of this message | ||
ID: 1894
Updated by: sander@php.net
Reported By: pete.nelson@ci.stpaul.mn.us
-Status: Open
+Status: Bogus
Bug Type: Misbehaving function
Operating System: SGI Irix 6.2
PHP Version: 3.0.11
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Previous Comments:
------------------------------------------------------------------------
[1999-11-11 19:38:33] joey@cvs.php.net
Seems unlikely that this is related to memcpy, but I am not a C guru.
Can you verify
that bug is still there (a/o 3.0.12?) If I had access to an SGI box,
I'd do it...
------------------------------------------------------------------------
[1999-07-29 16:21:59] pete.nelson@ci.stpaul.mn.us
Seems to be a problem with the memcpy function used in functions/dns.c
(line 180 in v3.0.11).
Test of the function confirm - the same C code works on Linux & Windows
(gcc), but returns 255.255.255.255 on my Irix boxes.
------------------------------------------------------------------------
[1999-07-27 13:42:18] pete.nelson@ci.stpaul.mn.us
I wanted to make a hostname lookup page, and realized that it couldn't
be done
on either of my SGI indys. It works fine under RedHat linux, Win98 &
WinNT (all
running apache 1.3.6). My guess is a bug in the SGI system libraries -
it does get a little nutty.
Here's my script:
<html><head><title>Host Checker</title></head>
<body bgcolor=white>
<h1>Test a Host</h1>
<?php
if(! isset($host)) { $host = "friday"; }
// The Input:
echo "<form action=\"http-check.php3\" method=post>";
echo "<input type=text name=host size=30 value=\"$host\">";
echo "<input type=submit value=\"Check Host\">";
echo "</form>";
// Check DNS
$ip = gethostbyname($host);
echo "<h2>DNS Entry for <font size=+3
color=blue>$host</font></h2>\n";
echo "<b>$host:</b> $ip\n";
// The HTTP Request:
echo "<p><hr align=center width=85%>";
echo "<h2>HTTP Response from <font size=+3
color=blue>$host</font></h2>\n";
$fp = fsockopen("$ip", 80, &$errnr, &$errstr);
if(! $fp) {
echo "<h1><font color=red>Error!</font></h1>";
echo "<p>$errstr ($errnr)";
exit;
}
fputs($fp, "HEAD / HTTP/1.0\n\n");
// The HTTP Response:
while(!$end) {
$line = fgets($fp, 2048);
if(trim($line) == "") { $end = true; }
else { echo "<BR>$line"; }
}
fclose($fp);
?>
</body></html>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=1894&edit=1