]> granicus.if.org Git - php/commitdiff
Fixed register_argc_argv behavior. Now it behave in the same way as before in all...
authorDmitry Stogov <dmitry@php.net>
Mon, 20 Mar 2006 10:15:02 +0000 (10:15 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 20 Mar 2006 10:15:02 +0000 (10:15 +0000)
main/php_variables.c

index 07840e2d32fdd3e84146c6619d4bf0807ea46a14..e0f220be058ea6abdfcbd577416b09031601a7b2 100644 (file)
@@ -736,6 +736,23 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
 {
        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 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
                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 */
 }