#40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading

From: Date: Sun, 11 Mar 2007 14:51:19 +0000
Subject: #40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110194@lists.php.net to get a copy of this message
ID: 40750 User updated by: andreas dot rieber at 2e-systems dot com Reported By: andreas dot rieber at 2e-systems dot com -Status: Feedback +Status: Open Bug Type: Network related -Operating System: OpenSuse +Operating System: OpenSuse, Ubuntu PHP Version: 5.2.1 New Comment: we reproduced it on second OS and wrote better test: --TEST-- Bug #40750 (default_socket_timeout Test) --FILE-- <?php ini_set( 'default_socket_timeout', 5); $fp = fsockopen( 'www.php.net', 80, &$errno, &$errstr, 3); $start = time(); $data = fread( $fp, 8192); fclose( $fp); echo time() - $start; ?> --EXPECT-- 5 Previous Comments: ------------------------------------------------------------------------ [2007-03-09 10:30:48] tony2001@php.net Not reproducible. ------------------------------------------------------------------------ [2007-03-08 13:32:45] andreas dot rieber at 2e-systems dot com I tried now also the latest snapshoot (php5.2-200703081130) and double checked my default_socket_timeout which is 60. The fgets gets the timeout from fsockopen. ------------------------------------------------------------------------ [2007-03-07 21:59:20] tony2001@php.net >The manual says for fsockopen: > Note: If you need to set a timeout for reading/writing data over the > socket, use stream_set_timeout(), as the timeout parameter to > fsockopen() only applies while connecting the socket. That's still correct, there were no changes to this behavior. ------------------------------------------------------------------------ [2007-03-07 20:00:16] andreas dot rieber at 2e-systems dot com I want to use the default connection timeout for read/write but a shorter timeout to connect (here 5 seconds). What happens is that the first fgets gets also the 5 seconds timeout and so my header is empty. The manual says for fsockopen: Note: If you need to set a timeout for reading/writing data over the socket, use stream_set_timeout(), as the timeout parameter to fsockopen() only applies while connecting the socket. and thats absolut ok and what i want. It worked with php 5.2.0 and before but not with 5.2.1. ------------------------------------------------------------------------ [2007-03-07 18:41:56] tony2001@php.net I get "Header OK". Also I don't understand what the expected result has to do with the timeout. ------------------------------------------------------------------------ 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 http://bugs.php.net/40750 -- Edit this bug report at http://bugs.php.net/?id=40750&edit=1

« previous php.bugs (#110194) next »