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

From: Date: Thu, 07 Feb 2008 00:44:42 +0000
Subject: #44065 [Opn]: fsockopen() throws warning and doesn't return error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122052@lists.php.net to get a copy of this message
ID: 44065 Updated by: msaraujo@php.net Reported By: joe at digg dot com Status: Open Bug Type: Streams related Operating System: Linux devwww25 2.6.12-1-amd64-k8 PHP Version: 5.2.5 New Comment: Hello, I have not been able to reproduce it. Can please give us an extra explanation about it? Previous Comments: ------------------------------------------------------------------------ [2008-02-06 22:37:42] joe at digg dot com 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 this bug report at http://bugs.php.net/?id=44065&edit=1

« previous php.bugs (#122052) next »