summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
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 /Zend/zend_builtin_functions.c
parente82f112468bc8c46e5cb006850634aa780e8e68d (diff)
downloadphp-git-887189ca31eeac5f1f7dbcaf54405de0dc432f2d.tar.gz
Refactored IS_INDIRECT usage for CV and object properties to support HashTable resizing
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 5691fd0b69..06c4774873 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -593,9 +593,18 @@ ZEND_FUNCTION(each)
zend_error(E_WARNING,"Variable passed to each() is not an array or object");
return;
}
- entry = zend_hash_get_current_data(target_hash);
- if (!entry) {
- RETURN_FALSE;
+ while (1) {
+ entry = zend_hash_get_current_data(target_hash);
+ if (!entry) {
+ RETURN_FALSE;
+ } else if (Z_TYPE_P(entry) == IS_INDIRECT) {
+ entry = Z_INDIRECT_P(entry);
+ if (Z_TYPE_P(entry) == IS_UNDEF) {
+ zend_hash_move_forward(target_hash);
+ continue;
+ }
+ }
+ break;
}
array_init(return_value);
@@ -999,6 +1008,13 @@ ZEND_FUNCTION(get_object_vars)
zend_hash_internal_pointer_reset_ex(properties, &pos);
while ((value = zend_hash_get_current_data_ex(properties, &pos)) != NULL) {
+ if (Z_TYPE_P(value) == IS_INDIRECT) {
+ value = Z_INDIRECT_P(value);
+ if (Z_TYPE_P(value) == IS_UNDEF) {
+ zend_hash_move_forward_ex(properties, &pos);
+ continue;
+ }
+ }
if (zend_hash_get_current_key_ex(properties, &key, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) {
zend_unmangle_property_name_ex(key->val, key->len, &class_name, &prop_name, (int*) &prop_len);