#44065 [NEW]: fsockopen() throws warning and doesn't return error

From: Date: Wed, 06 Feb 2008 22:37:42 +0000
Subject: #44065 [NEW]: fsockopen() throws warning and doesn't return error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122047@lists.php.net to get a copy of this message
From: joe at digg dot com Operating system: Linux devwww25 2.6.12-1-amd64-k8 PHP version: 5.2.5 PHP Bug Type: Streams related Bug description: fsockopen() throws warning and doesn't return error Description: ------------ When getaddrinfo fails fsockopen() fails to return an error string or error code. Reproduce code: --------------- <?php $code = 0; $message = ''; $fp = fsockopen('www.asdf98070978.org', 80, $code, $message); if (!is_resource($fp)) { echo 'ERROR: ' . $message . '(#' . $code . ')' . "\n"; } else { echo 'Connected!' . "\n"; fclose($fp); } ?> Expected result: ---------------- fsockopen() should return false and set an appropriate error code and error message. Actual result: -------------- It spits out a warning and doesn't include any sort of error message or string: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/jstump/repository/wildcat/branches/config/foo.php on line 5 Warning: fsockopen(): unable to connect to www.asdf98070978.org:80 (Unknown error) in /home/jstump/repository/wildcat/branches/config/foo.php on line 5 ERROR: (#0) -- Edit bug report at http://bugs.php.net/?id=44065&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=44065&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44065&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44065&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44065&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44065&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44065&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44065&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44065&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44065&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44065&r=support Expected behavior: http://bugs.php.net/fix.php?id=44065&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44065&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44065&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44065&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44065&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=44065&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44065&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44065&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44065&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44065&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44065&r=mysqlcfg

« previous php.bugs (#122047) next »