Re: cvs: php4 /sapi/cli php_cli.c

From: Date: Fri, 24 May 2002 07:10:26 +0000
Subject: Re: cvs: php4 /sapi/cli php_cli.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12068@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);' Edin

« previous php.cvs (#12068) next »