dmitry          Fri Mar 17 08:59:02 2006 UTC

  Modified files:              
    /php-src/main       php_variables.c 
  Log:
  Allowed 'auto_globals_jit' work together with 'register_argc_argv'
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.120&r2=1.121&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.120 php-src/main/php_variables.c:1.121
--- php-src/main/php_variables.c:1.120  Thu Mar 16 09:44:42 2006
+++ php-src/main/php_variables.c        Fri Mar 17 08:59:02 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.120 2006/03/16 09:44:42 dmitry Exp $ */
+/* $Id: php_variables.c,v 1.121 2006/03/17 08:59:02 dmitry Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -639,7 +639,7 @@
        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 @@
        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 @@
        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 */
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to