cvs: php4 /main main.c
| From: | Zeev Suraski | Date: | Wed, 08 Aug 2001 16:36:06 +0000 |
| Subject: | cvs: php4 /main main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6651@lists.php.net to get a copy of this message | ||
zeev Wed Aug 8 12:36:06 2001 EDT
Modified files:
/php4/main main.c
Log:
- Implement new short names - $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_FILES
- Use the Zend Engine infrastructure - make these variables available in
all functions
Index: php4/main/main.c
diff -u php4/main/main.c:1.398 php4/main/main.c:1.399
--- php4/main/main.c:1.398 Sun Aug 5 12:21:32 2001
+++ php4/main/main.c Wed Aug 8 12:36:04 2001
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.398 2001/08/05 16:21:32 sas Exp $ */
+/* $Id: main.c,v 1.399 2001/08/08 16:36:04 zeev Exp $ */
/* {{{ includes
*/
@@ -85,6 +85,28 @@
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 @@
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 @@
}
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 @@
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;
}