dmitry          Mon Mar 20 10:15:02 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/main       php_variables.c 
  Log:
  Fixed register_argc_argv behavior. Now it behave in the same way as before in 
all combinations with register_globals, register_long_arrays, variables_order 
and auto_globals_jit.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.104.2.6&r2=1.104.2.7&diff_format=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.104.2.6 
php-src/main/php_variables.c:1.104.2.7
--- php-src/main/php_variables.c:1.104.2.6      Fri Mar 17 08:58:51 2006
+++ php-src/main/php_variables.c        Mon Mar 20 10:15:02 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.104.2.6 2006/03/17 08:58:51 dmitry Exp $ */
+/* $Id: php_variables.c,v 1.104.2.7 2006/03/20 10:15:02 dmitry Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -736,6 +736,23 @@
 {
        if (PG(variables_order) && (strchr(PG(variables_order),'S') || 
strchr(PG(variables_order),'s'))) {
                php_register_server_variables(TSRMLS_C);
+
+               if (PG(register_argc_argv)) {
+                       if (SG(request_info).argc) {
+                               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);
+                               }
+                       } else {
+                               php_build_argv(SG(request_info).query_string, 
PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
+                       }
+               }
+       
        } else {
                zval *server_vars=NULL;
                ALLOC_ZVAL(server_vars);
@@ -754,19 +771,7 @@
                zend_hash_update(&EG(symbol_table), "HTTP_SERVER_VARS", 
sizeof("HTTP_SERVER_VARS"), &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