Doc #60824 [Opn->Csd]: gethostbyaddr() returns FALSE on failure

From: Date: Sat, 21 Jan 2012 20:52:38 +0000
Subject: Doc #60824 [Opn->Csd]: gethostbyaddr() returns FALSE on failure
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7801@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60824&edit=1 ID: 60824 Updated by: frozenfire@php.net Reported by: alvaro at demogracia dot com Summary: gethostbyaddr() returns FALSE on failure -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: 5.3.9 -Assigned To: +Assigned To: frozenfire Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2012-01-21 20:39:51] frozenfire@php.net Automatic comment from SVN on behalf of frozenfire Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=322545 Log: Clarified that gethostbyaddr will return false on malformed input. Closes bug #60824. ------------------------------------------------------------------------ [2012-01-20 20:07:52] alvaro at demogracia dot com Description: ------------ --- From manual page: http://www.php.net/function.gethostbyaddr --- In "Return Values" we read: «Returns the host name or the unmodified ip_address on failure.» ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ However, there are situations where the function appears to return FALSE on failure. Test script: --------------- <?php // Return unmodified argument var_dump( gethostbyaddr(33) ); var_dump( gethostbyaddr('192.168.0.100') ); // Non-existing LAN address // Return FALSE and trigger a warning var_dump( gethostbyaddr(NULL) ); var_dump( gethostbyaddr('php.net') ); Expected result: ---------------- string(2) "33" string(13) "192.168.0.100" string(0): "" string(7): "php.net" Actual result: -------------- string(2) "33" string(13) "192.168.0.100" Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in C:\tmp\test.php on line 8 bool(false) Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in C:\tmp\test.php on line 9 bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60824&edit=1

« previous php.doc.bugs (#7801) next »