|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-01-20 11:56 UTC] landeholm at gmail dot com
[2012-01-22 13:49 UTC] [email protected]
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: cataphract
[2012-01-22 20:30 UTC] [email protected]
[2012-01-22 20:57 UTC] [email protected]
[2012-01-22 20:57 UTC] [email protected]
-Status: Assigned
+Status: Closed
[2012-03-05 01:56 UTC] [email protected]
-Status: Closed
+Status: Re-Opened
[2012-03-05 01:56 UTC] [email protected]
[2012-03-06 14:47 UTC] john dot papaioannou at gmail dot com
[2012-04-18 09:46 UTC] [email protected]
[2012-05-15 12:23 UTC] olouvignes at gmail dot com
[2012-05-15 12:30 UTC] [email protected]
-Status: Re-Opened
+Status: Closed
[2012-05-15 12:33 UTC] [email protected]
[2012-07-24 23:37 UTC] [email protected]
[2013-11-17 09:34 UTC] [email protected]
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 31 05:00:01 2025 UTC |
Description: ------------ stream_get_line() will block even though data has been received and there are lines ready to be parsed in php's internal buffer. It makes it impossible for example to implement a blocking HTTP server as the server will only parse the first line in the HTTP request and then both the server and client will hang as both are waiting for more data. Test script: --------------- $c = pcntl_fork(); if ($c > 0) { $socket = stream_socket_server("tcp://127.0.0.1:10000"); $socket2 = stream_socket_accept($socket); while (!feof($socket2)) print "server got line: " . stream_get_line($socket2, 1024, "\r\n") . "\n"; print "server done\n"; } else { sleep(1); $socket = stream_socket_client("tcp://127.0.0.1:10000"); fwrite($socket, "test #1\r\ntest2\r\ntest3\r\ntest4\r\n"); fread($socket, 1000); print "client done\n"; } die(0); Expected result: ---------------- client done server got line: test #1 server got line: test2 server got line: test3 server got line: test4 server done Actual result: -------------- server got line: test #1