ID:               42044
 User updated by:  zeusgerde at arcor dot de
 Reported By:      zeusgerde at arcor dot de
 Status:           Bogus
 Bug Type:         Streams related
 Operating System: Windows XP
 PHP Version:      5.2.3
 New Comment:

Removed the @
Added error_reporting(E_ALL);
display_errors is on

Result: the same as mentioned in first post

> Also read the manual page for stream_select again

I did but did not find anything matching my problem.

http://php.net/stream_select says:
| Note: When stream_select() returns, the arrays read, write and
| except are modified to indicate which stream resource(s) actually
| changed status.

Seems not to change anything.

http://php.net/stream_select says:
| On error FALSE  is returned and a warning raised (this can happen if
| the system call is interrupted by an incoming signal).

FALSE is not returned. No warning raised.

http://php.net/stream_select says:
| Note:  If you read/write to a stream returned in the arrays be aware
| that they do not necessarily read/write the full amount of data you
| have requested. Be prepared to even only be able to read/write a
| single byte.

I can not read a single byte.


Previous Comments:
------------------------------------------------------------------------

[2007-07-19 09:23:46] [EMAIL PROTECTED]

Remove the @ in front of stream_select() and you'll know why your code
does not work. Also read the manual page for stream_select again:
http://www.php.net/stream_select

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

[2007-07-19 09:04:40] zeusgerde at arcor dot de

Description:
------------
I try to read from STDIN in the windows console (cmd.exe).

With the code below I get as expected "0" several times until I start
typing.
But when I start typing (not hitting enter) I get "3", all arrays
contain STDIN, STDERR and STDOUT and fread() blocks (of course).
The same happens if I focus on another window with the mouse cursor.

Reproduce code:
---------------
while (1) {
  $aException = $aWrite = $aRead = Array(STDIN, STDERR, STDOUT);
  $iChangedStreams = @stream_select($aRead, $aWrite, $aException, 1,
0);
  echo $iChangedStreams;

  if ($iChangedStreams) {
    if (in_array(STDIN, $aRead, true)) {
      $strBuffer = fread(STDIN, 1);
    }
  }
}


Expected result:
----------------
$aRead == Array(STDIN);
$aWrite == Array(STDIN, STDOUT, STDERR);
$aException == Array();

/* not sure about STDIN in $aWrite */

Actual result:
--------------
$aRead == Array(STDIN, STDOUT, STDERR);
$aWrite == Array(STDIN, STDOUT, STDERR);
$aException == Array(STDIN, STDOUT, STDERR);



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


-- 
Edit this bug report at http://bugs.php.net/?id=42044&edit=1

Reply via email to