diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-03-26 18:07:31 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-03-26 18:07:31 +0400 |
commit | 887189ca31eeac5f1f7dbcaf54405de0dc432f2d (patch) | |
tree | 8536fb10f33fe14c6b9357a587374a276f509399 /main/php_variables.c | |
parent | e82f112468bc8c46e5cb006850634aa780e8e68d (diff) | |
download | php-git-887189ca31eeac5f1f7dbcaf54405de0dc432f2d.tar.gz |
Refactored IS_INDIRECT usage for CV and object properties to support HashTable resizing
Diffstat (limited to 'main/php_variables.c')
-rw-r--r-- | main/php_variables.c | 19 |
1 files changed, 14 insertions, 5 deletions
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); } } } |