[PHP-BUG] Bug #63730 [NEW]: gethostbyname() fails silently
From: cojabo-php at cjbn dot net Operating system: Ubuntu LTS PHP version: 5.3.19 Package: Network related Bug Type: Bug Bug description:gethostbyname() fails silently 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: --- 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 -- Edit bug report at https://bugs.php.net/bug.php?id=63730&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63730&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63730&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63730&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63730&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63730&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63730&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63730&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63730&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=63730&r=support Expected behavior: https://bugs.php.net/fix.php?id=63730&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63730&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63730&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63730&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63730&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63730&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63730&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=63730&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63730&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63730&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63730&r=mysqlcfg
Bug #63730 [Nab]: gethostbyname() fails silently
Edit report at https://bugs.php.net/bug.php?id=63730&edit=1 ID: 63730 User updated by:cojabo-php at cjbn dot net Reported by:cojabo-php at cjbn dot net Summary:gethostbyname() fails silently Status: Not a bug Type: Bug Package:Network related Operating System: Ubuntu LTS PHP Version:5.3.19 Block user comment: N Private report: N New Comment: What is the reason for that failure? How do I determine this? It seems strange that the "intended behavior" would be to fail without giving the user any means whatsoever to correct the failure. Previous Comments: [2012-12-09 13:14:16] larue...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php "Returns the IPv4 address or a string containing the *unmodified hostname* on failure." http://us1.php.net/manual/en/function.gethostbyname.php ---- [2012-12-08 23:18:07] cojabo-php at cjbn dot net 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: --- 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 -- Edit this bug report at https://bugs.php.net/bug.php?id=63730&edit=1