diff options
| author | Shane Caraveo <shane@php.net> | 2003-05-19 06:46:50 +0000 |
|---|---|---|
| committer | Shane Caraveo <shane@php.net> | 2003-05-19 06:46:50 +0000 |
| commit | 331f905e8aeac5bdd88d456500f3b90fe9dadc68 (patch) | |
| tree | 4cb7eb6412c1aeec9cfa26db9cb373598af54e8e /sapi/cgi/cgi_main.c | |
| parent | 3987509ac364763a05208cb5dbb0d3855e64eb9b (diff) | |
| download | php-git-331f905e8aeac5bdd88d456500f3b90fe9dadc68.tar.gz | |
MFH
continuation on bugfix #13757
make argv/argc *and* query_string work correctly when running cgi in shell
Diffstat (limited to 'sapi/cgi/cgi_main.c')
| -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 24e6027d89..aebbe90f8f 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1279,6 +1279,9 @@ consult the installation file that came with this distribution, or visit \n\ case 'f': /* parse file */ script_file = estrdup(ap_php_optarg); no_headers = 1; + /* arguments after the file are considered script args */ + SG(request_info).argc = argc - (ap_php_optind-1); + SG(request_info).argv = &argv[ap_php_optind-1]; break; case 'g': /* define global variables on command line */ @@ -1385,6 +1388,9 @@ consult the installation file that came with this distribution, or visit \n\ } if (!SG(request_info).path_translated && argc > ap_php_optind) { + /* arguments after the file are considered script args */ + SG(request_info).argc = argc - ap_php_optind; + SG(request_info).argv = &argv[ap_php_optind]; /* file is on command line, but not in -f opt */ SG(request_info).path_translated = estrdup(argv[ap_php_optind++]); } @@ -1398,7 +1404,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 > ap_php_optind) { len = 0; for (i = ap_php_optind; i < argc; i++) { len += strlen(argv[i]) + 1; |
