summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-03-17 08:58:51 +0000
committerDmitry Stogov <dmitry@php.net>2006-03-17 08:58:51 +0000
commit55159796b09d92e8dd63f41c567fdf17d31c64d1 (patch)
tree00031ea27ed9bb2af0e20164dc16f39d2c4ba5e6 /main/php_variables.c
parentd82462485ecc5a7ccc639cfec7ef3a25d634ca88 (diff)
downloadphp-git-55159796b09d92e8dd63f41c567fdf17d31c64d1.tar.gz
Allowed 'auto_globals_jit' work together with 'register_argc_argv'
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index da81aa6901..07840e2d32 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -423,8 +423,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
int count = 0;
char *ss, *space;
- if (! (PG(register_globals) || SG(request_info).argc ||
- PG(http_globals)[TRACK_VARS_SERVER]) ) {
+ if (!(PG(register_globals) || SG(request_info).argc || track_vars_array)) {
return;
}
@@ -614,7 +613,7 @@ int php_hash_environment(TSRMLS_D)
unsigned char _gpc_flags[5] = {0, 0, 0, 0, 0};
zval *dummy_track_vars_array = NULL;
zend_bool initialized_dummy_track_vars_array=0;
- zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays) && !PG(register_argc_argv));
+ zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
struct auto_global_record {
char *name;
uint name_len;
@@ -756,6 +755,18 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
PG(http_globals)[TRACK_VARS_SERVER]->refcount++;
}
+ if (PG(register_argc_argv)) {
+ zval **argc, **argv;
+
+ if (zend_hash_find(&EG(symbol_table), "argc", sizeof("argc"), (void**)&argc) == SUCCESS &&
+ zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void**)&argv) == SUCCESS) {
+ (*argc)->refcount++;
+ (*argv)->refcount++;
+ zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv"), argv, sizeof(zval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc"), argc, sizeof(zval *), NULL);
+ }
+ }
+
return 0; /* don't rearm */
}