]> granicus.if.org Git - php/commitdiff
Allowed 'auto_globals_jit' work together with 'register_argc_argv'
authorDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 08:59:02 +0000 (08:59 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 08:59:02 +0000 (08:59 +0000)
main/php_variables.c

index 10888ec5f1607d8ae1b16ce9d9395028dbf45466..8e2bb87f3092d7fd5287ed4a815e8a0248081a31 100644 (file)
@@ -639,7 +639,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
        int count = 0;
        char *ss, *space;
        
-       if (! (SG(request_info).argc || PG(http_globals)[TRACK_VARS_SERVER]) ) {
+       if (!(SG(request_info).argc || track_vars_array)) {
                return;
        }
        
@@ -818,7 +818,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_argc_argv));
+       zend_bool jit_initialization = PG(auto_globals_jit);
        struct auto_global_record {
                char *name;
                uint name_len;
@@ -934,6 +934,18 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
        zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
        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 */
 }