summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-03-26 18:07:31 +0400
committerDmitry Stogov <dmitry@zend.com>2014-03-26 18:07:31 +0400
commit887189ca31eeac5f1f7dbcaf54405de0dc432f2d (patch)
tree8536fb10f33fe14c6b9357a587374a276f509399 /main
parente82f112468bc8c46e5cb006850634aa780e8e68d (diff)
downloadphp-git-887189ca31eeac5f1f7dbcaf54405de0dc432f2d.tar.gz
Refactored IS_INDIRECT usage for CV and object properties to support HashTable resizing
Diffstat (limited to 'main')
-rw-r--r--main/main.c15
-rw-r--r--main/php_variables.c19
2 files changed, 21 insertions, 13 deletions
diff --git a/main/main.c b/main/main.c
index 0f8a029b51..931a5246c6 100644
--- a/main/main.c
+++ b/main/main.c
@@ -857,13 +857,10 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
if (PG(track_errors) && module_initialized &&
(Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
- if (!EG(active_symbol_table)) {
- zend_rebuild_symbol_table(TSRMLS_C);
- }
- if (EG(active_symbol_table)) {
- zval tmp;
- ZVAL_STRINGL(&tmp, buffer, buffer_len);
- zend_hash_str_update(&EG(active_symbol_table)->ht, "php_errormsg", sizeof("php_errormsg")-1, &tmp);
+ zval tmp;
+ ZVAL_STRINGL(&tmp, buffer, buffer_len);
+ if (zend_set_local_var("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
+ zval_ptr_dtor(&tmp);
}
}
if (replace_buffer) {
@@ -1195,7 +1192,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
if (EG(active_symbol_table)) {
zval tmp;
ZVAL_STRINGL(&tmp, buffer, buffer_len);
- zend_hash_str_update(&EG(active_symbol_table)->ht, "php_errormsg", sizeof("php_errormsg")-1, &tmp);
+ if (zend_set_local_var("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0 TSRMLS_CC) == FAILURE) {
+ zval_ptr_dtor(&tmp);
+ }
}
}
diff --git a/main/php_variables.c b/main/php_variables.c
index 47b2c522bd..20bee7e8d9 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -181,10 +181,19 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
return;
}
} else {
- if ((gpc_element_p = zend_symtable_str_find(symtable1, index, index_len)) == NULL
- || Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
- array_init(&gpc_element);
- gpc_element_p = zend_symtable_str_update(symtable1, index, index_len, &gpc_element);
+ gpc_element_p = zend_symtable_str_find(symtable1, index, index_len);
+ if (!gpc_element_p) {
+ zval tmp;
+ array_init(&tmp);
+ gpc_element_p = zend_symtable_str_update_ind(symtable1, index, index_len, &tmp);
+ } else {
+ if (Z_TYPE_P(gpc_element_p) == IS_INDIRECT) {
+ gpc_element_p = Z_INDIRECT_P(gpc_element_p);
+ }
+ if (Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
+ zval_ptr_dtor(gpc_element_p);
+ array_init(gpc_element_p);
+ }
}
}
symtable1 = Z_ARRVAL_P(gpc_element_p);
@@ -219,7 +228,7 @@ plain_var:
zend_symtable_str_exists(symtable1, index, index_len)) {
zval_ptr_dtor(&gpc_element);
} else {
- gpc_element_p = zend_symtable_str_update(symtable1, index, index_len, &gpc_element);
+ gpc_element_p = zend_symtable_str_update_ind(symtable1, index, index_len, &gpc_element);
}
}
}