#28247 [Opn]: CLI sapi option -R does not work as expected
| From: | helly@php.net | Date: | Sun, 02 May 2004 08:42:12 +0000 |
| Subject: | #28247 [Opn]: CLI sapi option -R does not work as expected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59122@lists.php.net to get a copy of this message | ||
ID: 28247
Updated by: helly@php.net
Reported By: aaron at wormus dot com
Status: Open
Bug Type: CGI related
-Operating System: Windows 2000
+Operating System: *
PHP Version: 5.0.0RC2
New Comment:
I don't think this is expected behavior.
As a workaround you can do this for now:
ll CVS|php -R 'echo $argn."\n";'
Previous Comments:
------------------------------------------------------------------------
[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