dmitry Mon Mar 20 10:18:50 2006 UTC Modified files: /php-src/main php_variables.c /php-src/tests/basic 011.phpt Log: Fixed register_argc_argv behavior. Now it behave in the same way as before in combinations with variables_order and auto_globals_jit. $argc and $argv global variables are registered only in CLI mode and under $_SERVER[] in other case. (This is done because register_globals was removed and assumed - off). http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.122&r2=1.123&diff_format=u Index: php-src/main/php_variables.c diff -u php-src/main/php_variables.c:1.122 php-src/main/php_variables.c:1.123 --- php-src/main/php_variables.c:1.122 Fri Mar 17 15:04:22 2006 +++ php-src/main/php_variables.c Mon Mar 20 10:18:50 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.122 2006/03/17 15:04:22 dmitry Exp $ */ +/* $Id: php_variables.c,v 1.123 2006/03/20 10:18:50 dmitry Exp $ */ #include <stdio.h> #include "php.h" @@ -639,7 +639,7 @@ int count = 0; char *ss, *space; - if (!(SG(request_info).argc || (s && *s))) { + if (!(SG(request_info).argc || track_vars_array)) { return; } @@ -696,7 +696,7 @@ argc->is_ref = 0; argc->refcount = 0; - if (Z_LVAL_P(argc)) { + if (SG(request_info).argc) { arr->refcount++; argc->refcount++; zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL); @@ -920,6 +920,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); @@ -934,18 +951,6 @@ 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 */ } http://cvs.php.net/viewcvs.cgi/php-src/tests/basic/011.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/tests/basic/011.phpt diff -u php-src/tests/basic/011.phpt:1.5 php-src/tests/basic/011.phpt:1.6 --- php-src/tests/basic/011.phpt:1.5 Fri Mar 17 15:04:23 2006 +++ php-src/tests/basic/011.phpt Mon Mar 20 10:18:50 2006 @@ -8,8 +8,8 @@ ab+cd+ef+123+test --FILE-- <?php -for ($i=0; $i<$argc; $i++) { - echo "$i: ".$argv[$i]."\n"; +for ($i=0; $i<$_SERVER['argc']; $i++) { + echo "$i: ".$_SERVER['argv'][$i]."\n"; } ?> --EXPECT--
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php