ID: 46024 Updated by: [EMAIL PROTECTED] Reported By: mike at silverorange dot com -Status: Open +Status: Closed Bug Type: Streams related Operating System: linux PHP Version: 5.2CVS-2008-09-09 (snap) New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2008-09-15 02:58:08] mike at silverorange dot com If I use 8192 as the number of bytes for fread(), the correct value is returned. Examining the program with strace() reveals: - PHP always reads 8192 bytes from fread - the requested bytes are returned and the remaining bytes are buffered - stream_select() only invokes a system select() call if the internal buffer is empty - stream_select() returns the wrong value if no actual system select() call is performed. See additional test cases at the above link. ------------------------------------------------------------------------ [2008-09-09 03:30:03] mike at silverorange dot com The test also fails on the provided snapshot. ------------------------------------------------------------------------ [2008-09-08 14:33:47] mike at silverorange dot com Description: ------------ The stream_select function should return the number of streams ready in the read and write arrays. Sometimes it does and sometimes it doesn't. Reproduce code: --------------- http://labs.silverorange.com/files/stream-select-bug/ Expected result: ---------------- selecting ... got 2 Array ( [0] => Resource id #5 ) Array ( [0] => Resource id #6 ) selecting ... got 2 Array ( [0] => Resource id #5 ) Array ( [0] => Resource id #6 ) Actual result: -------------- selecting ... got 2 Array ( [0] => Resource id #5 ) Array ( [0] => Resource id #6 ) selecting ... got 1 Array ( [0] => Resource id #5 ) Array ( [0] => Resource id #6 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46024&edit=1
