#42044 [NEW]: stream_select
| From: | zeusgerde at arcor dot de | Date: | Thu, 19 Jul 2007 09:04:40 +0000 |
| Subject: | #42044 [NEW]: stream_select | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-115221@lists.php.net to get a copy of this message | ||
From: zeusgerde at arcor dot de
Operating system: Windows XP
PHP version: 5.2.3
PHP Bug Type: Filesystem function related
Bug description: stream_select
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 bug report at http://bugs.php.net/?id=42044&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42044&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42044&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42044&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42044&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42044&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42044&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42044&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42044&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42044&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42044&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42044&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42044&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42044&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42044&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42044&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42044&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42044&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42044&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42044&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42044&r=mysqlcfg