|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-19 09:23 UTC] jani@php.net
[2007-07-19 09:39 UTC] zeusgerde at arcor dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
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);