|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-09 13:14 UTC] laruence@php.net
-Status: Open
+Status: Not a bug
[2012-12-09 13:14 UTC] laruence@php.net
[2012-12-09 15:08 UTC] cojabo-php at cjbn dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 19:00:01 2025 UTC |
Description: ------------ gethostbyname() fails to return an IP; dns_get_record() works. No error message of any kind is generated. This happens for any domain I've tried. Test script: --------------- <pre> <? $domain='www.example.com'; echo "gethostbyname($domain)\n"; var_dump(gethostbyname($domain)); echo "\n"; echo "dns_get_record($domain,DNS_A)\n"; var_dump(dns_get_record($domain,DNS_A)); echo $notice; fopen('warning','r'); Expected result: ---------------- gethostbyname(www.example.com) string() "192.0.43.10" dns_get_record(www.example.com,DNS_A) array(1) { [0]=> array(5) { ["host"]=> string(15) "www.example.com" ["type"]=> string(1) "A" ["ip"]=> string(11) "192.0.43.10" ["class"]=> string(2) "IN" ["ttl"]=> int(3020) } } Notice: Undefined variable: notice in /www/dev/dynamic/test.php on line 14 Warning: fopen(warning): failed to open stream: No such file or directory in /www/dev/dynamic/test.php on line 15 Actual result: -------------- gethostbyname(www.example.com) string(15) "www.example.com" dns_get_record(www.example.com,DNS_A) array(1) { [0]=> array(5) { ["host"]=> string(15) "www.example.com" ["type"]=> string(1) "A" ["ip"]=> string(11) "192.0.43.10" ["class"]=> string(2) "IN" ["ttl"]=> int(3020) } } Notice: Undefined variable: notice in /www/dev/dynamic/test.php on line 14 Warning: fopen(warning): failed to open stream: No such file or directory in /www/dev/dynamic/test.php on line 15