Bug #12360 [Com]: fsockopen timeout doesn't work

From: Date: Thu, 23 Feb 2017 10:00:40 +0000
Subject: Bug #12360 [Com]: fsockopen timeout doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207518@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=12360&edit=1 ID: 12360 Comment by: mars dot msn at gmail dot com Reported by: sheep at fearthisclan dot com Summary: fsockopen timeout doesn't work Status: No Feedback Type: Bug Package: Sockets related Operating System: FreeBSD PHP Version: 4.3.2 Block user comment: N Private report: N New Comment: With PHP 5.6 i am still experiencing this same problem. When an IP+PORT is blocked by a firewall, it doesn't timeout at the set time, but keeps waiting for 30seconds. Previous Comments: ------------------------------------------------------------------------ [2006-05-10 18:21:07] adult at adult-inc dot biz Hello. I'm experiencing same problems with PHP 4.3.4 for Win32. ======== | CODE | ======== $socket = fsockopen($ip, $port, &$errno, &$errstr, 5); stream_set_blocking($socket, FALSE ); stream_set_timeout($socket, 5); fputs($socket, $request); $html = ""; while (!feof($socket)) { $html = $html.fgets($socket, 128); } fclose($socket); ========== | Result | ========== I got a fatal error after 30 seconds of running. I tried even 600 seconds in max_execution_time and have no luck - still have the same error. Looks like script hangs up while connecting to non-existent port on remote host. PS: Notice that i'm using only IP-addresses to connect, no hostnames! So the problem not in DNS-resolving. ------------------------------------------------------------------------ [2005-01-14 20:40:23] shelby at coolpage dot com Patching the DNS just eliminates the hanging on DNS. That doesn't fix the fact that the timeout isn't working. This is still broken, see: http://bugs.php.net/bug.php?id=24867 ------------------------------------------------------------------------ [2004-02-03 07:02:31] johannes at zoomposters dot com I got it to work now by setting up my own dns server. It's apparently at the DNS lookup that the code hangs and where the timeout has no effect. ------------------------------------------------------------------------ [2004-01-30 02:45:59] johannes at zoomposters dot com The timeout still doesn't work. The function doesn't hang but the timeout has no effect at all. Using: Redhat 9 http://snaps.php.net/php4-STABLE-latest.tar.gz (2004-01-30) ------------------------------------------------------------------------ [2004-01-06 20:53:41] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=12360 -- Edit this bug report at https://bugs.php.net/bug.php?id=12360&edit=1

« previous php.bugs (#207518) next »