From: php at xuefeng dot org
Operating system: Redhat 2.6.9-42.ELsmp #1 SMP i68
PHP version: 5.2.5
PHP Bug Type: Network related
Bug description: gethostbyname() can't return a valid ip address.
Description:
------------
When trying to resolv the ip address of a hostname given in /etc/hosts,
it's works fine, but does not work when trying to resolv via the DNS server
though.
btw: those test code works fine with php 5.2.1
Reproduce code:
---------------
var_dump(dns_get_record("xxx.xxx.com"));
var_dump(fsockopen("xxx.xxx.com", 80, $error, $errstr));
Expected result:
----------------
array(1) {
[0]=>
array(5) {
["host"]=>
string(12) "xxx.xxx.com"
["type"]=>
string(1) "A"
["ip"]=>
string(13) "192.168.200.6"
["class"]=>
string(2) "IN"
["ttl"]=>
int(86400)
}
}
resource(20) of type (stream)
Actual result:
--------------
array(1) {
[0]=>
array(5) {
["host"]=>
string(12) "xxx.xxx.com"
["type"]=>
string(1) "A"
["ip"]=>
string(13) "192.168.200.6"
["class"]=>
string(2) "IN"
["ttl"]=>
int(86400)
}
}
<br />
<b>Warning</b>: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]:
php_network_getaddresses: getaddrinfo failed: Temporary failure in name
resolution in <b>/opt/wwwroot/qun_inner/modules/club/my_signatures.php</b>
on line <b>68</b><br />
<br />
<b>Warning</b>: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]: unable to connect to
xxx.xxx.com:80 (Unknown error) in
<b>/opt/wwwroot/qun_inner/modules/club/my_signatures.php</b> on line
<b>68</b><br />
bool(false)
--
Edit bug report at http://bugs.php.net/?id=43687&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43687&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43687&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43687&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43687&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43687&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43687&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43687&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43687&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43687&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43687&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43687&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43687&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43687&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43687&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43687&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43687&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43687&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43687&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43687&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43687&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43687&r=mysqlcfg