note 116319 added to function.gethostbyname
| From: | devers | Date: | Thu, 11 Dec 2014 17:38:02 +0000 |
| Subject: | note 116319 added to function.gethostbyname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201117@lists.php.net to get a copy of this message | ||
This function says "Returns the IPv4 address or a string containing the unmodified hostname on
failure.
This isn't entirely true, any hostname with a null byte in it will only return the characters
BEFORE the null byte.
<?php
$hostname = "foo\0bar";
var_dump($hostname );
var_dump(gethostbyname($hostname ));
?>
Results:
string 'foo�bar' (length=7)
string 'foo' (length=3)
----
Server IP: 72.52.91.14
Probable Submitter: 2001:19f0:1000:5123:c91b:736d:ae19:6ea
----
Manual Page -- http://php.net/manual/en/function.gethostbyname.php
Edit -- https://master.php.net/note/edit/116319
Del: integrated -- https://master.php.net/note/delete/116319/integrated
Del: useless -- https://master.php.net/note/delete/116319/useless
Del: bad code -- https://master.php.net/note/delete/116319/bad+code
Del: spam -- https://master.php.net/note/delete/116319/spam
Del: non-english -- https://master.php.net/note/delete/116319/non-english
Del: in docs -- https://master.php.net/note/delete/116319/in+docs
Del: other reasons-- https://master.php.net/note/delete/116319
Reject -- https://master.php.net/note/reject/116319
Search -- https://master.php.net/manage/user-notes.php