#40750 [NEW]: fsockopen timeout parameter overwrites timeout for reading

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #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

  2. Similar Questions and Discussions

    1. #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: ...
    2. #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: ...
    3. 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...
    4. 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...
    5. #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: ...
  3. #2

    Default #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

  4. #3

    Default #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

  5. #4

    Default #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:
    >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.


    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

  6. #5

    Default #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]
    >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] [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

  7. #6

    Default #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]
    >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] [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

  8. #7

    Default #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]
    >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] [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

  9. #8

    Default #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]
    >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.

    ------------------------------------------------------------------------

    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

  10. #9

    Default #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]
    >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.

    ------------------------------------------------------------------------

    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

  11. #10

    Default #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

  12. #11

    Default #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

  13. #12

    Default #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

  14. #13

    Default #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

  15. #14

    Default #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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139