From: mjpph at stardust dot fi
Operating system: Linux (Fedora Core 3)
PHP version: 5CVS-2005-05-08 (dev)
PHP Bug Type: CGI related
Bug description: socket stream opened with stream_socket_client doesnt work
with stream_select
Description:
------------
Using stream_socket_client or stream_socket_server to open a connection
fails to report correct values with stream_select. Using fread to get one
byte before stream_select suddenly makes stream_select work as expected.
Without it stream_select returns 0 changed streams even though there is
data waiting. Service used as an endpoint is persistent and doesn't close
the connection after it's output. PHP is CLI-version.
Reproduce code:
---------------
$c = stream_socket_client("tcp://127.0.0.1:80");
while (1)
{
$streams = array($c);
if (stream_select($streams, $write=NULL, $except=NULL, 0, 5000)) {
print "Data received\n";
}
}
// IP:Port can be anything which outputs something after connection.
Expected result:
----------------
Text "Data received" after connection and output from the service. The
service can be anything which just outputs something right after connect.
Actual result:
--------------
Nothing. stream_select returns 0 even though there is data waiting.
--
Edit bug report at http://bugs.php.net/?id=32979&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32979&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32979&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32979&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32979&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32979&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32979&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32979&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32979&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32979&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32979&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32979&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32979&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32979&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32979&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32979&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32979&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32979&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32979&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32979&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32979&r=mysqlcfg