]> 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:58:51 +0000 (08:58 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 08:58:51 +0000 (08:58 +0000)
NEWS
main/php_variables.c

diff --git a/NEWS b/NEWS
index 302643c7977ee010ecb03afe8a1d6b1c1162aa23..8cd01b3b9a161ae1f0d1a3fd09d53f2378b6d23e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Mar 2006, PHP 5.1.3RC2
+- Allowed 'auto_globals_jit' work together with 'register_argc_argv'. (Dmitry)
 - Eliminated run-time constant fetching for TRUE, FALSE and NULL. (Dmitry)
 - Fixed offset/length parameter validation in substr_compare() function. (Ilia)
 - Added overflow checks to wordwrap() function. (Ilia)
index da81aa6901c739559ab7390f5f0a91cb8185d4b5..07840e2d32fdd3e84146c6619d4bf0807ea46a14 100644 (file)
@@ -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 */
 }