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

From: Date: Fri, 24 May 2002 21:31:09 +0000
Subject: Re: cvs: php4 /sapi/cli php_cli.c
References: 1 2 3 4  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12092@lists.php.net to get a copy of this message
On Fri, 2002-05-24 at 16:08, Sterling Hughes wrote: > > > > 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. But having to actually open a stream for stdout does not necessarily look so nice and integrated. ;-) I think STD{IN,OUT,ERR} constants are a good idea. It makes sense to have them opened by default in CLI, not necessarily in other SAPIs. - Stig

« previous php.cvs (#12092) next »