diff options
author | Shane Caraveo <shane@php.net> | 2003-05-19 06:46:19 +0000 |
---|---|---|
committer | Shane Caraveo <shane@php.net> | 2003-05-19 06:46:19 +0000 |
commit | 92dfadb1e05dc11f5b4b93b68f06a545192b06ea (patch) | |
tree | 493ae05a25f55eca03b1978dc0b77de7b5e35b9f /sapi | |
parent | 8e3772a8273dd3d6346798d09b87819da31879e7 (diff) | |
download | php-git-92dfadb1e05dc11f5b4b93b68f06a545192b06ea.tar.gz |
continuation on bugfix #13757
make argv/argc *and* query_string work correctly when running cgi in shell
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/cgi/cgi_main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 3125a46f2b..d8503d1c07 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1320,6 +1320,9 @@ consult the installation file that came with this distribution, or visit \n\ case 'f': /* parse file */ script_file = estrdup(optarg); no_headers = 1; + /* arguments after the file are considered script args */ + SG(request_info).argc = argc - (optind-1); + SG(request_info).argv = &argv[optind-1]; break; case 'g': /* define global variables on command line */ @@ -1415,6 +1418,9 @@ consult the installation file that came with this distribution, or visit \n\ } if (!SG(request_info).path_translated && argc > optind) { + /* arguments after the file are considered script args */ + SG(request_info).argc = argc - optind; + SG(request_info).argv = &argv[optind]; /* file is on command line, but not in -f opt */ SG(request_info).path_translated = estrdup(argv[optind++]); } @@ -1428,7 +1434,7 @@ consult the installation file that came with this distribution, or visit \n\ test.php "v1=test&v2=hello world!" test.php v1=test "v2=hello world!" */ - if (!SG(request_info).query_string) { + if (!SG(request_info).query_string && argc > optind) { len = 0; for (i = optind; i < argc; i++) { len += strlen(argv[i]) + 1; |