cvs: php4(PHP_4_3) /sapi/cgi cgi_main.c

From: Date: Mon, 19 May 2003 06:46:50 +0000
Subject: cvs: php4(PHP_4_3) /sapi/cgi cgi_main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-21068@lists.php.net to get a copy of this message
shane Mon May 19 02:46:50 2003 EDT Modified files: (Branch: PHP_4_3) /php4/sapi/cgi cgi_main.c Log: MFH continuation on bugfix #13757 make argv/argc *and* query_string work correctly when running cgi in shell Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.190.2.27 php4/sapi/cgi/cgi_main.c:1.190.2.28 --- php4/sapi/cgi/cgi_main.c:1.190.2.27 Sun May 18 23:40:53 2003 +++ php4/sapi/cgi/cgi_main.c Mon May 19 02:46:50 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cgi_main.c,v 1.190.2.27 2003/05/19 03:40:53 shane Exp $ */ +/* $Id: cgi_main.c,v 1.190.2.28 2003/05/19 06:46:50 shane Exp $ */ #include "php.h" #include "php_globals.h" @@ -1279,6 +1279,9 @@ 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 @@ } 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 @@ 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;

« previous php.cvs (#21068) next »