Re: cvs: php4 /sapi/cli php_cli.c
| From: | Sterling Hughes | Date: | Fri, 24 May 2002 14:08:46 +0000 |
| Subject: | Re: cvs: php4 /sapi/cli php_cli.c | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-12069@lists.php.net to get a copy of this message | ||
> > > edink Thu May 23 21:17:37 2002 EDT
> > >
> > > Modified files:
> > > /php4/sapi/cli php_cli.c
> > > Log:
> > > Register STDIN, STDOUT, and STDERR "constants" in cli in cases where
> > > script itself is not being loaded from STDIN.
> > >
> > > This enables constructs like fwrite(STDERR, "Error 42");
> > >
> >
> > Please don't do this... PHP has a mechanism for this already, ala
> > php://stderr, php://stdout, php://stdin and the streams/fopen wrappers
> > stuff. We should be consistent either way.
>
> What this patch does is basically this:
>
> define ('STDIN', fopen('php://stdin', 'r');
> ...
>
> I thinks it's useful to have these file descriptors always present in order
> to make using cli as a command line pipe filter easier and more readable. An
> example:
>
> php -i | php -r 'while ($l=fgets(STDIN)) echo strip_tags($l);'
>
I understand what this does and/or what it is used for.... However, I
don't think this should be a 'CLI only' feature. Let's have one standard way
for accessing stdin, stdout, stderr and be consistent. Personally, I
think using streams is the best way to do it, since it just looks so
nice and integrated.
-Sterling