From: Zeev Suraski Date: Wed, 8 Aug 2001 16:36:04 +0000 (+0000) Subject: - Implement new short names - $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_FILES X-Git-Tag: BEFORE_EXP_MERGE~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f4453f4c118830bcf14b553f13318cb250c1c3e;p=php - Implement new short names - $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_FILES - Use the Zend Engine infrastructure - make these variables available in all functions --- diff --git a/main/main.c b/main/main.c index 9562470cef..0a512f83e4 100644 --- a/main/main.c +++ b/main/main.c @@ -85,6 +85,28 @@ PHPAPI int core_globals_id; static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC); + +static char *short_track_vars_names[] = { + "_POST", + "_GET", + "_COOKIE", + "_SERVER", + "_ENV", + "_FILES", + NULL +}; + +static int short_track_vars_names_length[] = { + sizeof("_POST"), + sizeof("_GET"), + sizeof("_COOKIE"), + sizeof("_SERVER"), + sizeof("_ENV"), + sizeof("_FILES") +}; + + + #define SAFE_FILENAME(f) ((f)?(f):"-") /* {{{ PHP_INI_MH @@ -760,6 +782,7 @@ int php_module_startup(sapi_module_struct *sf) zend_utility_values zuv; int module_number=0; /* for REGISTER_INI_ENTRIES() */ char *php_os; + int i; #ifdef ZTS zend_executor_globals *executor_globals; void ***tsrm_ls; @@ -868,6 +891,9 @@ int php_module_startup(sapi_module_struct *sf) } zuv.import_use_extension = ".php"; + for (i=0; i<6; i++) { + zend_register_auto_global(short_track_vars_names[i], short_track_vars_names_length[i]-1 TSRMLS_CC); + } zend_set_utility_values(&zuv); php_startup_sapi_content_types(); @@ -1103,6 +1129,8 @@ static int php_hash_environment(TSRMLS_D) PG(http_globals)[i] = dummy_track_vars_array; } zend_hash_update(&EG(symbol_table), track_vars_names[i], track_vars_names_length[i], &PG(http_globals)[i], sizeof(zval *), NULL); + PG(http_globals)[i]->refcount++; + zend_hash_update(&EG(symbol_table), short_track_vars_names[i], short_track_vars_names_length[i], &PG(http_globals)[i], sizeof(zval *), NULL); } return SUCCESS; }