Date: 09/25/01
- Next message: Jim Winstead: "Re: [PHP-DEV] [PATCH] fix gethostbyname() to return false when hostname not resolved"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] [PATCH] fix gethostbyname() to return false when hostname not resolved"
- In reply to: Sterling Hughes: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Next in thread: jimw <email protected>: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Reply: jimw <email protected>: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 25 Sep 2001, Sterling Hughes wrote:
> On 25 Sep 2001 brooks <email protected> wrote:
>
> > ID: 13443
> > User updated by: brooks <email protected>
> > Reported By: brooks <email protected>
> > Status: Duplicate
> > Bug Type: Unknown/Other Function
> > Operating System: BSDI 4.1
> > PHP Version: 4.0.6
> > New Comment:
> >
> > IMHO this is not the same as #13423, which is why I didn't list it in the original report. Although the data returned is the same (hostname instead of IP address) the reason for the failure is seems very different.
> >
>
> your humble opinion is wrong ;), PHP's gethostbyname() call's the
> low-level C gethostbyname(), if that doesn't resolve, it will return
> NULL, and PHP will return the original hostname. There would be no way
> that the C level gethostbyname() would return the original hostname.
>
> -Sterling
I completely agree with you. I just think we're talking about 2 different
things. I agree that the php_gethostbyname call should NOT return the
hostname if it fails. My problem is that it is failing for no good
reason, as it seems others have reported. My server is a production 4.1
BSDI system with perfectly functioning resolver libraries.
vp3: {225} % dig vp3.netgate.net
; <<>> DiG 8.2 <<>> vp3.netgate.net
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUERY SECTION:
;; vp3.netgate.net, type = A, class = IN
;; ANSWER SECTION:
vp3.netgate.net. 12H IN A 205.214.170.247
Yet, this fails:
$sitename = "vp3.netgate.net";
$ipadres = gethostbynamel($sitename);
$count = count($ipadres);
echo "$count";
for ($i=0; $i<$count; $i++) {
echo("
$ipadres[$i]
");
}
With this output:
Text generated by PHP
0Open Connection Failed 0
I'm in complete agreement with you that gethostbyname should not return
the hostname, gethostbynamel seems to work correctly. But, why is it
failing? If I fall back to a 3.0.14 things work perfectly. Let me know
what I can do to help track this down.
Kevin
>
> > Previous Comments:
> > ------------------------------------------------------------------------
> >
> > [2001-09-25 16:45:51] jimw <email protected>
> >
> > duplicate of 13423, among the others listed in the report. gethostbyname() returns the hostname it is passed when the C-level gethostbyname() call fails.
> >
> > ------------------------------------------------------------------------
> >
> > [2001-09-25 16:22:34] brooks <email protected>
> >
> > This is basically the same report as 8754, 12678, and 8856. The gethostbyname function returns the name instead of the IP address. The host is configured correctly and names can be resolved from the shell using nslookup, dig, etc. This bug first appeared in 4.0.4 (although I didn't know it until now) and is present in 4.0.6 and 4.0.8-dev (php4-200109251335.tar.gz - latest from the snapshots dir as of 9/26/01). I regressed the bug back to my previous version of 3.0.14 and the bug is not present in that version. I have tried both gethostbyname (returns the name) and gethostbynamel (returns 0 items in the array).
> >
> > ------------------------------------------------------------------------
> >
> >
> >
> > Edit this bug report at http://bugs.php.net/?id=13443&edit=1
> >
> >
> >
>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jim Winstead: "Re: [PHP-DEV] [PATCH] fix gethostbyname() to return false when hostname not resolved"
- Previous message: Rasmus Lerdorf: "Re: [PHP-DEV] [PATCH] fix gethostbyname() to return false when hostname not resolved"
- In reply to: Sterling Hughes: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Next in thread: jimw <email protected>: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Reply: jimw <email protected>: "Re: [PHP-DEV] Bug #13443 Updated: gethostbyname returns the name not the IP addr."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

