iliaa Sat Jun 14 11:08:27 2003 EDT
Modified files:
/php4/main main.c php_variables.c
Log:
Fixed bug #24007 (Problem with register_globals & arrays)
Index: php4/main/main.c
diff -u php4/main/main.c:1.558 php4/main/main.c:1.559
--- php4/main/main.c:1.558 Thu Jun 12 04:38:58 2003
+++ php4/main/main.c Sat Jun 14 11:08:26 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.558 2003/06/12 08:38:58 derick Exp $ */
+/* $Id: main.c,v 1.559 2003/06/14 15:08:26 iliaa Exp $ */
/* {{{ includes
*/
@@ -1580,6 +1580,21 @@
case 'C':
php_autoglobal_merge(Z_ARRVAL_P(form_variables),
Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC);
break;
+ }
+ }
+
+ if (PG(register_globals)) {
+ HashPosition pos;
+ zval **data;
+ char *string_key;
+ uint string_key_len;
+
+ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(form_variables), &pos);
+ while (zend_hash_get_current_data_ex(Z_ARRVAL_P(form_variables), (void
**)&data, &pos) == SUCCESS) {
+ zend_hash_get_current_key_ex(Z_ARRVAL_P(form_variables),
&string_key, &string_key_len, NULL, 0, &pos);
+
+ ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), string_key,
string_key_len, *data, (*data)->refcount+1, 0);
+ zend_hash_move_forward_ex(Z_ARRVAL_P(form_variables), &pos);
}
}
Index: php4/main/php_variables.c
diff -u php4/main/php_variables.c:1.62 php4/main/php_variables.c:1.63
--- php4/main/php_variables.c:1.62 Tue Jun 10 16:03:42 2003
+++ php4/main/php_variables.c Sat Jun 14 11:08:27 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.c,v 1.62 2003/06/10 20:03:42 imajes Exp $ */
+/* $Id: php_variables.c,v 1.63 2003/06/14 15:08:27 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -67,23 +67,15 @@
char *ip; /* index pointer */
char *index;
int var_len, index_len;
- zval *gpc_element, **gpc_element_p, **top_gpc_p=NULL;
+ zval *gpc_element, **gpc_element_p;
zend_bool is_array;
HashTable *symtable1=NULL;
- HashTable *symtable2=NULL;
assert(var != NULL);
if (track_vars_array) {
symtable1 = Z_ARRVAL_P(track_vars_array);
}
- if (PG(register_globals)) {
- if (symtable1) {
- symtable2 = EG(active_symbol_table);
- } else {
- symtable1 = EG(active_symbol_table);
- }
- }
if (!symtable1) {
/* Nothing to do */
zval_dtor(val);
@@ -168,9 +160,6 @@
efree(escaped_index);
}
}
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
symtable1 = Z_ARRVAL_PP(gpc_element_p);
/* ip pointed to the '[' character, now obtain the key */
index = index_s;
@@ -193,18 +182,8 @@
} else {
zend_hash_update(symtable1, index, index_len+1,
&gpc_element, sizeof(zval *), (void **) &gpc_element_p);
}
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
break;
}
- }
-
- if (top_gpc_p) {
- if (symtable2) {
- zend_hash_update(symtable2, var, var_len+1, top_gpc_p,
sizeof(zval *), NULL);
- (*top_gpc_p)->refcount++;
- }
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php