Re: argv/argc
| From: | rasmus@php.net | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: argv/argc | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-15011@lists.php.net to get a copy of this message | ||
> > On Fri, 28 Jan 2000, Zeev Suraski wrote:
> > > It would in this specific case, but I think that if people expect
> > > argv/argc, they expect them to exist and be empty in case of an empty
> > > query.
> > >
> > > Any reason not to selectively turn argv/argc off by an INI directive?
> >
> > What about cgi version where argv/argc are supposed to come from the
> > command line arguments?
>
> It's never been like that. $argc/$argv always reflected the contents of
> the QUERY_STRING.
I am not sure I understand that statement. Obviously $argc and $argv are
set based on the command line args in the cgi version. Using PHP 3, look:
#!./php -q
<?
echo $argv[1];
?>
$ ./t abc
abc
Works the same for PHP 4, so what do you mean it *always* reflects the
contents of the QUERY_STRING? I have no QUERY_STRING env variable set in
this case.
As for why we need the http://www.php.net/?blah URL. It is
very handy to
be able to access "blah" directly via $argv[0]. Just having it set in the
symbol table to an empty value and needing to look through $GLOBALS or
$HTTP_GET_VARS is a hassle. This has worked since PHP 2, so changing this
default is going to break some sites, including one of mine. I don't mind
an ini option to turn it off to increase performance, but we can't just
drop this feature.
-Rasmus