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:
---------------
<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
--
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