|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30699 Have gethostbyname return error information in additional variables
Submitted: 2004-11-06 11:21 UTC Modified: 2014-12-30 10:41 UTC
From: Assigned:
Status: No Feedback Package: Network related
PHP Version: * OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2004-11-06 11:21 UTC]
It will be helpful to make gethostbyname return error status in additional variables like fsockopen does for example in int &errno, string &errstr.

Now gethostbyname returns a string containing the unmodified hostname on failure, but rather often it is desirable to know why the operation failed and output standart system text error message without inventing own ones. That way you can search information on internet with a higher probability to find an answer in case of errors.

It should not be too difficult to implement since WSAGetLastError() from WinSock2 returns generic error code and here you can find error code descriptions.

Expected result:
string gethostbyname ( string hostname[, int &errno [, string &errstr]] )

Actual result:
string gethostbyname ( string hostname )


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-21 20:25 UTC]
-Summary: make gethostbyname return error status in additional variables +Summary: Have gethostbyname return error information in additional variables -Status: Open +Status: Feedback -Package: Feature/Change Request +Package: Network related -PHP Version: 4.3.9 +PHP Version: *
 [2014-04-21 20:25 UTC]
At a glance I was unable to find any update to this; is this something you are still interested in?
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot 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 "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 16:01:24 2023 UTC