RE: [PHP-DEV] auto_globals_jit and register_argc_argv disconnect

From: Date: Thu, 16 Mar 2006 08:42:36 +0000
Subject: RE: [PHP-DEV] auto_globals_jit and register_argc_argv disconnect
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-22479@lists.php.net to get a copy of this message
diff :) Dmitry. > -----Original Message----- > From: Pierre [mailto:pierre.dev@gmail.com] > Sent: Thursday, March 16, 2006 10:52 AM > To: "Dmitry Stogov" > Subject: Re: [PHP-DEV] auto_globals_jit and > register_argc_argv disconnect > > > On Wed, 15 Mar 2006 20:28:11 +0300 > dmitry@zend.com ("Dmitry Stogov") wrote: > > > Understood. > > The patch is in attachment. > > Not here, .txt? > > --Pierre > >

Index: main/php_variables.c =================================================================== RCS file: /repository/php-src/main/php_variables.c,v retrieving revision 1.104.2.5 diff -u -p -d -r1.104.2.5 php_variables.c --- main/php_variables.c 13 Feb 2006 12:18:16 -0000 1.104.2.5 +++ main/php_variables.c 15 Mar 2006 17:27:10 -0000 @@ -423,8 +423,7 @@ static void php_build_argv(char *s, zval 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 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 */ }
« previous php.internals (#22479) next »