File a bug report. stream_set_blocking() started to work for files only since version 4.3, so it is likely full of bugs. Actualy, using cli php 4.3.2 I got this results some weird results. Your version run infinitely but changing echo 'Fooo!'."\n"; to echo 'Fooo!'; (removing newline) resulted in the same behavior as you experienced. fread did not return false even if no key was pressed, only empty string but this might be correct, i don't know. Both fgetc and fgets did return false.

Robert Cummings wrote:

On Sat, 2003-09-20 at 02:02, Curt Zirzow wrote:

hmm.. on second thought...

* Thus wrote Robert Cummings ([EMAIL PROTECTED]):

[...]
       if( ($char = fread( $stdin, 1 )) !== false )

How are you calling this script? I'm not sure how cgi will handle fread <stdin>

With a traditional CGI script <stdin> is what is read on POST data
from a form, and php takes care of this.

That is where my confusion is now.


I'm calling it as "php -qC foo.php". The fread() should work since it
works on input when I don't have stdin in non-blocking mode. Perhaps
it's a bug. I took a look at the doc on streams again, and it uses
php://input as the POST stream. Maybe it's a bug.

Cheers,
Rob.

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to