cvs: php-src(PHP_5_0) /main php_variables.c
| From: | Dmitry Stogov | Date: | Wed, 01 Jun 2005 09:43:48 +0000 |
| Subject: | cvs: php-src(PHP_5_0) /main php_variables.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-32057@lists.php.net to get a copy of this message | ||
dmitry Wed Jun 1 05:43:48 2005 EDT
Modified files: (Branch: PHP_5_0)
/php-src/main php_variables.c
Log:
Fixed "refcount" counting for autoglobals
http://cvs.php.net/diff.php/php-src/main/php_variables.c?r1=1.81.2.10&r2=1.81.2.11&ty=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.81.2.10 php-src/main/php_variables.c:1.81.2.11
--- php-src/main/php_variables.c:1.81.2.10 Tue May 31 13:40:48 2005
+++ php-src/main/php_variables.c Wed Jun 1 05:43:48 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.81.2.10 2005/05/31 17:40:48 dmitry Exp $ */
+/* $Id: php_variables.c,v 1.81.2.11 2005/06/01 09:43:48 dmitry Exp $ */
#include <stdio.h>
#include "php.h"
@@ -262,12 +262,21 @@
INIT_PZVAL(array_ptr);
switch (arg) {
case PARSE_POST:
+ if (PG(http_globals)[TRACK_VARS_POST]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ }
PG(http_globals)[TRACK_VARS_POST] = array_ptr;
break;
case PARSE_GET:
+ if (PG(http_globals)[TRACK_VARS_GET]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ }
PG(http_globals)[TRACK_VARS_GET] = array_ptr;
break;
case PARSE_COOKIE:
+ if (PG(http_globals)[TRACK_VARS_COOKIE]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ }
PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
break;
}
@@ -512,6 +521,9 @@
ALLOC_ZVAL(array_ptr);
array_init(array_ptr);
INIT_PZVAL(array_ptr);
+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ }
PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
PG(magic_quotes_gpc) = 0;
@@ -685,10 +697,9 @@
dummy_track_vars_array->refcount++;
}
PG(http_globals)[i] = dummy_track_vars_array;
- } else {
- PG(http_globals)[i]->refcount++;
}
+ PG(http_globals)[i]->refcount++;
zend_hash_update(&EG(symbol_table), auto_global_records[i].name,
auto_global_records[i].name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
if (PG(register_long_arrays)) {
zend_hash_update(&EG(symbol_table), auto_global_records[i].long_name,
auto_global_records[i].long_name_len, &PG(http_globals)[i], sizeof(zval *), NULL);
@@ -716,6 +727,9 @@
ALLOC_ZVAL(server_vars);
array_init(server_vars);
INIT_PZVAL(server_vars);
+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ }
PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
}
@@ -737,6 +751,9 @@
ALLOC_ZVAL(env_vars);
array_init(env_vars);
INIT_PZVAL(env_vars);
+ if (PG(http_globals)[TRACK_VARS_ENV]) {
+ zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
+ }
PG(http_globals)[TRACK_VARS_ENV] = env_vars;
if (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e')) {