#34972 [NEW]: STDIN won't allow nonblocking.

From: Date: Mon, 24 Oct 2005 21:07:02 +0000
Subject: #34972 [NEW]: STDIN won't allow nonblocking.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86999@lists.php.net to get a copy of this message
From:             VJTD3 at VJTD3 dot com
Operating system: Windows/Linux
PHP version:      5.0.5
PHP Bug Type:     CGI related
Bug description:  STDIN won't allow nonblocking.

Description:
------------
STDIN won't allow nonblocking.

Reproduce code:
---------------
<?php

 stream_set_blocking(STDIN, FALSE);
 while (1) {
  echo 'infinate loop showing nonblocking problem'."\n";
  echo 'said:'.fgets(STDIN, 1024);
 }

?>

Expected result:
----------------
The test code should be a infinate loop with "infinate loop showing
nonblocking problem" said trillions of times fast like a infinate loop is
suposto do when you make a boo boo. instead it will say it once then wait
for input then wait again etc as a blocked resource is expected. but
"stream_set_blocking(STDIN, FALSE);" should be allowing it to do the loop
unblocked resulting in major screen flooding yet unblocking the resource
is ignored.

This means you can't do something like a client program in your shell that
is "interactive" like a Telnet client or similar.

I can dig the whole not reading as typing because that would be too "raw"
for common usage... [ie phrasing the backspaces etc though maybe a
seperate abaility? this would allow arrow key kinda stuff and similar...]
But waiting for a "\n" or whatever file ending shouldn't have any effect
on that loop. It should act just like a TCP or any other connection when
unblocked there the resource just has a return of no data.

"php -f test.php" I use to run it.

Actual result:
--------------
uses blocking when "stream_set_blocking(STDIN, FALSE);" was used.

-- 
Edit bug report at http://bugs.php.net/?id=34972&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34972&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34972&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34972&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34972&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34972&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34972&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34972&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34972&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34972&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34972&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=34972&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=34972&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34972&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34972&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34972&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34972&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34972&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34972&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34972&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34972&r=mysqlcfg


Thread (44 messages)

« previous php.bugs (#86999) next »