Re: Re: RFC: CLI behave like SH or PERL/RUBY/PYTHON?

From: Date: Wed, 23 Oct 2002 07:20:31 +0000
Subject: Re: Re: RFC: CLI behave like SH or PERL/RUBY/PYTHON?
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-89962@lists.php.net to get a copy of this message
Alan Knowles wrote: > To try and clarify... > > #!/usr/bin/php -q > <? > > echo "please enter a word"; flush(); // is needed here, since above line does not have newline. > $fh = fopen('php://stdin') > $s = fgets($fh,100); > echo "you entered $s" ; > > ?> > > Would this be affected by the change? - eg. would you need to flush(); > before the prompt appeared? I wrote impclit_flush setting in php_cli.c will prevent changing the setting. (I thought it will not due to CLI doc) I take it back, since it is done in early stage, the setting is over written by php.ini apparently. It's confusing, since it's differs from php.ini-dist/recommended. [yohgaki@dev DEV]$ /usr/local/apache/bin/php -i | grep implicit_flush implicit_flush => On => Off (This makes PG(implicit_flush)=1 in php_cli.c still bogus) From main/main.c STD_PHP_INI_BOOLEAN("implicit_flush", "0", PHP_INI_PERDIR|PHP _INI_SYSTEM,OnUpdateBool, implicit_flush, php_core_globals, co re_globals) The default should be the same as main.c, IMO. Removing the line from the php_cli.c will make CLI behavior more consistent. If CLI should flush for every echo/print, more consistent way of handling the setting is needed at least. BTW, whether I like it or not, users can change OG(implicit_flush) to call flush() always when echo/print is used. -- Yasuo Ohgaki

« previous php.dev (#89962) next »