From: Edin Kadribasic Date: Sun, 6 Jan 2002 13:58:05 +0000 (+0000) Subject: Added argc and argv in request_info needed for the new cli sapi. X-Git-Tag: PRE_ISSET_PATCH~272 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1788410a56c7ee10fdaabb7d438c7938158c8d4c;p=php Added argc and argv in request_info needed for the new cli sapi. Modified registering $argc and $argv to support cli sapi. --- diff --git a/main/SAPI.h b/main/SAPI.h index b8748d0c19..9ca41da77b 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -97,6 +97,10 @@ typedef struct { /* this is necessary for Safe Mode */ char *current_user; int current_user_length; + + /* this is necessary for CLI module */ + int argc; + char **argv; } sapi_request_info; diff --git a/main/main.c b/main/main.c index a6b7bb107e..a4a44ac187 100644 --- a/main/main.c +++ b/main/main.c @@ -861,6 +861,8 @@ int php_module_startup(sapi_module_struct *sf) PG(header_is_being_sent) = 0; SG(request_info).headers_only = 0; SG(request_info).argv0 = NULL; + SG(request_info).argc=0; + SG(request_info).argv=(char **)NULL; PG(connection_status) = PHP_CONNECTION_NORMAL; PG(during_request_startup) = 0; @@ -1195,7 +1197,21 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC) INIT_PZVAL(arr); /* Prepare argv */ - if (s && *s) { + if (SG(request_info).argc) { /* are we in cli sapi? */ + int i; + for (i=0; i