Ask a Question related to PHP Bugs, Design and Development.
-
andreas dot rieber at 2e-systems dot com #1
#40750 [NEW]: fsockopen timeout parameter overwrites timeout for reading
From: andreas dot rieber at 2e-systems dot com
Operating system: OpenSuse
PHP version: 5.2.1
PHP Bug Type: Network related
Bug description: fsockopen timeout parameter overwrites timeout for reading
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout of 5
seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
--
Edit bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40750&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40750&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40750&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40750&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40750&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40750&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40750&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40750&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40750&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40750&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40750&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40750&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40750&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40750&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40750&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40750&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40750&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40750&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40750&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40750&r=mysqlcfg[/url]
andreas dot rieber at 2e-systems dot com Guest
-
#12360 [Fbk->NoF]: fsockopen timeout doesn't work
ID: 12360 Updated by: sniper@php.net Reported By: hordur at modernus dot is -Status: Feedback +Status: ... -
#12360 [Csd->Opn]: fsockopen timeout doesn't work
ID: 12360 Updated by: wez@php.net Reported By: hordur at modernus dot is -Status: Closed +Status: ... -
Timeout and fsockopen
Hello! I'm trying to find if some host is up or not. For example $fp = @fsockopen ('www.damirjosar.com', 80, $errno, $errstr, 1); because... -
Can't get timeout to work with fsockopen
I'm trying to get a script to timeout if the server is under heavy load or otherwise unavailable. Eventually, this will try different mirrored... -
#24867 [Fbk->NoF]: problem with timeout parameter for fsockopen() function
ID: 24867 Updated by: sniper@php.net Reported By: tomato at pisem dot net -Status: Feedback +Status: ... -
tony2001@php.net #2
#40750 [Opn->Fbk]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Feedback
Bug Type: Network related
Operating System: OpenSuse
PHP Version: 5.2.1
New Comment:
I get "Header OK".
Also I don't understand what the expected result has to do with the
timeout.
Previous Comments:
------------------------------------------------------------------------
[2007-03-07 18:29:03] andreas dot rieber at 2e-systems dot com
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout
of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
andreas dot rieber at 2e-systems dot com #3
#40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading
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
PHP Version: 5.2.1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-03-07 18:41:56] [email]tony2001@php.net[/email]
I get "Header OK".
Also I don't understand what the expected result has to do with the
timeout.
------------------------------------------------------------------------
[2007-03-07 18:29:03] andreas dot rieber at 2e-systems dot com
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout
of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
andreas dot rieber at 2e-systems dot com Guest
-
tony2001@php.net #4
#40750 [Opn->Bgs]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Bogus
Bug Type: Network related
Operating System: OpenSuse
PHP Version: 5.2.1
New Comment:
That's still correct, there were no changes to this behavior.>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.
Previous Comments:
------------------------------------------------------------------------
[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] [email]tony2001@php.net[/email]
I get "Header OK".
Also I don't understand what the expected result has to do with the
timeout.
------------------------------------------------------------------------
[2007-03-07 18:29:03] andreas dot rieber at 2e-systems dot com
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout
of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
andreas dot rieber at 2e-systems dot com #5
#40750 [Bgs->Opn]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
User updated by: andreas dot rieber at 2e-systems dot com
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Bogus
+Status: Open
Bug Type: Network related
Operating System: OpenSuse
PHP Version: 5.2.1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-03-07 21:59:20] [email]tony2001@php.net[/email]
That's still correct, there were no changes to this behavior.>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.
------------------------------------------------------------------------
[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] [email]tony2001@php.net[/email]
I get "Header OK".
Also I don't understand what the expected result has to do with the
timeout.
------------------------------------------------------------------------
[2007-03-07 18:29:03] andreas dot rieber at 2e-systems dot com
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout
of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
andreas dot rieber at 2e-systems dot com Guest
-
tony2001@php.net #6
#40750 [Opn->Fbk]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Feedback
Bug Type: Network related
Operating System: OpenSuse
PHP Version: 5.2.1
New Comment:
Not reproducible.
Previous Comments:
------------------------------------------------------------------------
[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] [email]tony2001@php.net[/email]
That's still correct, there were no changes to this behavior.>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.
------------------------------------------------------------------------
[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] [email]tony2001@php.net[/email]
I get "Header OK".
Also I don't understand what the expected result has to do with the
timeout.
------------------------------------------------------------------------
[2007-03-07 18:29:03] andreas dot rieber at 2e-systems dot com
Description:
------------
The timeout parameter of fsockopen overwrites the general read/write
timeout. Without the timeout parameter in fsockopen or if you use
stream_set_timeout after fsockopen it works.
I created scipt a.php which opens b.php. the connection has a timeout
of 5 seconds. b.php sleeps for 7 seconds. The first fgets fails and
stream_get_meta_data shows that it timed out.
It works with php 5.2.0.
Reproduce code:
---------------
code a.php
<?php
$fp = @fsockopen( 'localhost', 80, &$errno, &$errstr, 5);
if( !$fp) die( "$errno: $errstr");
fwrite( $fp, "GET /b.php HTTP/1.0\r\nHost: localhost\r\n\r\n");
// read result
$data = '';
while( !feof( $fp)) {
$line = fgets( $fp, 8192);
if( trim( $line) == '')
break;
$data .= $line;
}
fclose( $fp);
// check header
if( eregi( '^HTTP\/[0-9\.]+ ([0-9]{3}) .*', $data, $reg)) {
echo "Header OK";
} else {
echo "Header failed";
}
?>
code b.php
<?php
sleep( 7);
?>
Expected result:
----------------
Header OK
Actual result:
--------------
Header failed
------------------------------------------------------------------------
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
andreas dot rieber at 2e-systems dot com #7
#40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading
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] [email]tony2001@php.net[/email]
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] [email]tony2001@php.net[/email]
That's still correct, there were no changes to this behavior.>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.
------------------------------------------------------------------------
[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] [email]tony2001@php.net[/email]
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
andreas dot rieber at 2e-systems dot com Guest
-
judas dot iscariote at gmail dot com #8
#40750 [Com]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Comment by: judas dot iscariote at gmail dot com
Reported By: andreas dot rieber at 2e-systems dot com
Status: Open
Bug Type: Network related
Operating System: OpenSuse, Ubuntu
PHP Version: 5.2.1
New Comment:
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
Previous Comments:
------------------------------------------------------------------------
[2007-03-11 14:51:19] andreas dot rieber at 2e-systems dot com
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
------------------------------------------------------------------------
[2007-03-09 10:30:48] [email]tony2001@php.net[/email]
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] [email]tony2001@php.net[/email]
That's still correct, there were no changes to this behavior.>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.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
judas dot iscariote at gmail dot com Guest
-
tony2001@php.net #9
#40750 [Opn->Fbk]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Feedback
Bug Type: Network related
Operating System: OpenSuse, Ubuntu
PHP Version: 5.2.1
New Comment:
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 05:24:24] judas dot iscariote at gmail dot com
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
------------------------------------------------------------------------
[2007-03-11 14:51:19] andreas dot rieber at 2e-systems dot com
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
------------------------------------------------------------------------
[2007-03-09 10:30:48] [email]tony2001@php.net[/email]
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] [email]tony2001@php.net[/email]
That's still correct, there were no changes to this behavior.>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.
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
andreas dot rieber at 2e-systems dot com #10
#40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading
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, Ubuntu
+Operating System: OpenSuse, Ubuntu, Redhat
PHP Version: 5.2.1
New Comment:
Now tested also redhat with same problem.
There is nothing special done:
tar xvzf php-5.2.1.tar.gz
cd php-5.2.1
../configure --enable-track-vars --with-mysql=/usr/local/mysql
--enable-trans-sid --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt --with-zlib-dir=/usr/lib/ --with-gd --enable-exif
--enable-soap --with-openssl --with-xmlrpc --enable-sockets
make
thats it...
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 09:34:12] [email]tony2001@php.net[/email]
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
------------------------------------------------------------------------
[2007-03-12 05:24:24] judas dot iscariote at gmail dot com
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
------------------------------------------------------------------------
[2007-03-11 14:51:19] andreas dot rieber at 2e-systems dot com
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
------------------------------------------------------------------------
[2007-03-09 10:30:48] [email]tony2001@php.net[/email]
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.
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
andreas dot rieber at 2e-systems dot com Guest
-
tony2001@php.net #11
#40750 [Opn->Fbk]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Feedback
Bug Type: Network related
Operating System: OpenSuse, Ubuntu, Redhat
PHP Version: 5.2.1
New Comment:
Remove all the configure options not related to the problem and figure
out what is the minimal list of options required to reproduce it.
Try with PHP CLI, with --enable-debug etc.
I still have no idea how to replicate it so far.
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 12:59:35] andreas dot rieber at 2e-systems dot com
Now tested also redhat with same problem.
There is nothing special done:
tar xvzf php-5.2.1.tar.gz
cd php-5.2.1
../configure --enable-track-vars --with-mysql=/usr/local/mysql
--enable-trans-sid --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt --with-zlib-dir=/usr/lib/ --with-gd --enable-exif
--enable-soap --with-openssl --with-xmlrpc --enable-sockets
make
thats it...
------------------------------------------------------------------------
[2007-03-12 09:34:12] [email]tony2001@php.net[/email]
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
------------------------------------------------------------------------
[2007-03-12 05:24:24] judas dot iscariote at gmail dot com
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
------------------------------------------------------------------------
[2007-03-11 14:51:19] andreas dot rieber at 2e-systems dot com
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
------------------------------------------------------------------------
[2007-03-09 10:30:48] [email]tony2001@php.net[/email]
Not reproducible.
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
andreas dot rieber at 2e-systems dot com #12
#40750 [Fbk->Opn]: fsockopen timeout parameter overwrites timeout for reading
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, Ubuntu, Redhat
PHP Version: 5.2.1
New Comment:
OK, openssl is causing the problem. So
../configure --with-openssl
will do it.
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 13:15:57] [email]tony2001@php.net[/email]
Remove all the configure options not related to the problem and figure
out what is the minimal list of options required to reproduce it.
Try with PHP CLI, with --enable-debug etc.
I still have no idea how to replicate it so far.
------------------------------------------------------------------------
[2007-03-12 12:59:35] andreas dot rieber at 2e-systems dot com
Now tested also redhat with same problem.
There is nothing special done:
tar xvzf php-5.2.1.tar.gz
cd php-5.2.1
../configure --enable-track-vars --with-mysql=/usr/local/mysql
--enable-trans-sid --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt --with-zlib-dir=/usr/lib/ --with-gd --enable-exif
--enable-soap --with-openssl --with-xmlrpc --enable-sockets
make
thats it...
------------------------------------------------------------------------
[2007-03-12 09:34:12] [email]tony2001@php.net[/email]
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
------------------------------------------------------------------------
[2007-03-12 05:24:24] judas dot iscariote at gmail dot com
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
------------------------------------------------------------------------
[2007-03-11 14:51:19] andreas dot rieber at 2e-systems dot com
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
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
andreas dot rieber at 2e-systems dot com Guest
-
tony2001@php.net #13
#40750 [Opn->Asn]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Updated by: [email]tony2001@php.net[/email]
Reported By: andreas dot rieber at 2e-systems dot com
-Status: Open
+Status: Assigned
Bug Type: Network related
Operating System: OpenSuse, Ubuntu, Redhat
PHP Version: 5.2.1
-Assigned To:
+Assigned To: tony2001
New Comment:
Ok, that helped.
I have a patch, but I need to discuss it with the extension maintainer
first.
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 14:32:44] andreas dot rieber at 2e-systems dot com
OK, openssl is causing the problem. So
../configure --with-openssl
will do it.
------------------------------------------------------------------------
[2007-03-12 13:15:57] [email]tony2001@php.net[/email]
Remove all the configure options not related to the problem and figure
out what is the minimal list of options required to reproduce it.
Try with PHP CLI, with --enable-debug etc.
I still have no idea how to replicate it so far.
------------------------------------------------------------------------
[2007-03-12 12:59:35] andreas dot rieber at 2e-systems dot com
Now tested also redhat with same problem.
There is nothing special done:
tar xvzf php-5.2.1.tar.gz
cd php-5.2.1
../configure --enable-track-vars --with-mysql=/usr/local/mysql
--enable-trans-sid --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt --with-zlib-dir=/usr/lib/ --with-gd --enable-exif
--enable-soap --with-openssl --with-xmlrpc --enable-sockets
make
thats it...
------------------------------------------------------------------------
[2007-03-12 09:34:12] [email]tony2001@php.net[/email]
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
------------------------------------------------------------------------
[2007-03-12 05:24:24] judas dot iscariote at gmail dot com
Im experiencing a very similar problem like this, probably not the same
but related, that makes our application stop working after upgrading
from php 5.2.0 to 5.2.1 all previuos versions do the job fine,
I 'll try to isolate the problem better.
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
tony2001@php.net Guest
-
judas dot iscariote at gmail dot com #14
#40750 [Com]: fsockopen timeout parameter overwrites timeout for reading
ID: 40750
Comment by: judas dot iscariote at gmail dot com
Reported By: andreas dot rieber at 2e-systems dot com
Status: Assigned
Bug Type: Network related
Operating System: OpenSuse, Ubuntu, Redhat
PHP Version: 5.2.1
Assigned To: tony2001
New Comment:
YUp, I confirm our code start to work again when openssl extension is
not loaded.
Previous Comments:
------------------------------------------------------------------------
[2007-03-12 15:16:55] [email]tony2001@php.net[/email]
Ok, that helped.
I have a patch, but I need to discuss it with the extension maintainer
first.
------------------------------------------------------------------------
[2007-03-12 14:32:44] andreas dot rieber at 2e-systems dot com
OK, openssl is causing the problem. So
../configure --with-openssl
will do it.
------------------------------------------------------------------------
[2007-03-12 13:15:57] [email]tony2001@php.net[/email]
Remove all the configure options not related to the problem and figure
out what is the minimal list of options required to reproduce it.
Try with PHP CLI, with --enable-debug etc.
I still have no idea how to replicate it so far.
------------------------------------------------------------------------
[2007-03-12 12:59:35] andreas dot rieber at 2e-systems dot com
Now tested also redhat with same problem.
There is nothing special done:
tar xvzf php-5.2.1.tar.gz
cd php-5.2.1
../configure --enable-track-vars --with-mysql=/usr/local/mysql
--enable-trans-sid --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt --with-zlib-dir=/usr/lib/ --with-gd --enable-exif
--enable-soap --with-openssl --with-xmlrpc --enable-sockets
make
thats it...
------------------------------------------------------------------------
[2007-03-12 09:34:12] [email]tony2001@php.net[/email]
What am I doing wrong?
# ./sapi/cli/php /tmp/5.php
5
# cat /tmp/5.php
<?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;
?>
------------------------------------------------------------------------
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
[url]http://bugs.php.net/40750[/url]
--
Edit this bug report at [url]http://bugs.php.net/?id=40750&edit=1[/url]
judas dot iscariote at gmail dot com Guest



Reply With Quote

