ID:               28247
 Updated by:       [EMAIL PROTECTED]
 Reported By:      aaron at wormus dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         CGI related
 Operating System: *
 PHP Version:      5.0.0RC2
-Assigned To:      
+Assigned To:      helly
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Looking at the code again it is expexcted behavior indeed.

Both the internal line fetching and STDIN obviously operate on the same
input stream. Therefore the code:
php -R 'echo $argn."\n".fgets(STDIN);'
shows every input line. In other words reading STDIN
changes the next input line or skips them.


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

[2004-05-02 10:42:11] [EMAIL PROTECTED]

I don't think this is expected behavior.

As a workaround you can do this for now:
ll CVS|php -R 'echo $argn."\n";'

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

[2004-05-02 10:02:13] aaron at wormus dot com

The original test that demonstrates this better is: 

cat file.txt | php -B "echo ++$num. ' ';" -R "echo ++$num. '
'.fgets(STDIN);"

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

[2004-05-01 23:56:24] aaron at wormus dot com

Description:
------------
the following command line script does not work as (I) expected.

php -R "echo fgets(STDIN);"

Instead of echoing every line, it echos every OTHER line. I am not sure
if this is the expected behaviour. I suspect something to be wrong. If
it is meant to happen, I would appreciate a short explaination :) I'm
writing an article on the CLI SAPI and this one is stumping me!

Aaron

Reproduce code:
---------------
php -R "echo fgets(STDIN);"

Expected result:
----------------
I expected it to work like:

perl -e "while (<STDIN>){print}"

echoing every line as you type it.



Actual result:
--------------
Echoes every OTHER line


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


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

Reply via email to