cvs: php4 /sapi/cgi cgi_main.c

From: Date: Mon, 19 May 2003 06:46:19 +0000
Subject: cvs: php4 /sapi/cgi cgi_main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-21067@lists.php.net to get a copy of this message
shane Mon May 19 02:46:19 2003 EDT Modified files: /php4/sapi/cgi cgi_main.c Log: 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.226 php4/sapi/cgi/cgi_main.c:1.227 --- php4/sapi/cgi/cgi_main.c:1.226 Sun May 18 23:40:33 2003 +++ php4/sapi/cgi/cgi_main.c Mon May 19 02:46:19 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cgi_main.c,v 1.226 2003/05/19 03:40:33 shane Exp $ */ +/* $Id: cgi_main.c,v 1.227 2003/05/19 06:46:19 shane Exp $ */ #include "php.h" #include "php_globals.h" @@ -1320,6 +1320,9 @@ 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 @@ } 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 @@ 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;

« previous php.cvs (#21067) next »