Bug #71675 [Opn->Nab]: gethostbyname not return unmodified hostname

From: Date: Sat, 27 Feb 2016 01:11:03 +0000
Subject: Bug #71675 [Opn->Nab]: gethostbyname not return unmodified hostname
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199497@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71675&edit=1 ID: 71675 Updated by: requinix@php.net Reported by: spacek at best-net dot cz Summary: gethostbyname not return unmodified hostname -Status: Open +Status: Not a bug Type: Bug Package: Network related Operating System: Unix PHP Version: 7.0.3 Block user comment: N Private report: N New Comment: This is how gethostbyname(3) behaves. http://linux.die.net/man/3/gethostbyname For numeric inputs, the behavior is explained in the inet_addr(3) docs. http://linux.die.net/man/3/inet_addr See your distro's documentation for more specific information. Previous Comments: ------------------------------------------------------------------------ [2016-02-26 23:09:38] spacek at best-net dot cz Description: ------------ Function gethostbyname() not return unmodified hostname in situation when the input string contains only numbers. Tested in: PHP 7.0.3 PHP 5.6.18 Test script: --------------- <?php echo gethostbyname('1111111').PHP_EOL; echo gethostbyname('111').PHP_EOL; echo gethostbyname('111.111').PHP_EOL; echo gethostbyname('111768768768768768.com').PHP_EOL; echo gethostbyname('a111').PHP_EOL; echo gethostbyname('foo').PHP_EOL; Expected result: ---------------- 1111111 111 111.111 111768768768768768.com a111 foo Actual result: -------------- 0.16.244.71 0.0.0.111 111.0.0.111 111768768768768768.com a111 foo ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71675&edit=1

« previous php.bugs (#199497) next »