diff options
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 5fa7fb908e..3051d19729 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1053,34 +1053,37 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro static int zval_update_class_constant(zval **pp, int is_static, int offset TSRMLS_DC) /* {{{ */ { - if ((Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || - (Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_ARRAY) { - zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); - - if ((*scope)->parent) { - zend_class_entry *ce = *scope; - HashPosition pos; - zend_property_info *prop_info; - - do { - for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); - zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS; - zend_hash_move_forward_ex(&ce->properties_info, &pos)) { - if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) && - offset == prop_info->offset) { - int ret; - zend_class_entry *old_scope = *scope; - *scope = prop_info->ce; - ret = zval_update_constant(pp, (void*)1 TSRMLS_CC); - *scope = old_scope; - return ret; - } - } - ce = ce->parent; - } while (ce); - + switch (Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) { + case IS_CONSTANT: + case IS_CONSTANT_ARRAY: + case IS_CONSTANT_AST: { + zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); + + if ((*scope)->parent) { + zend_class_entry *ce = *scope; + HashPosition pos; + zend_property_info *prop_info; + + do { + for (zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos); + zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop_info, &pos) == SUCCESS; + zend_hash_move_forward_ex(&ce->properties_info, &pos)) { + if (is_static == ((prop_info->flags & ZEND_ACC_STATIC) != 0) && + offset == prop_info->offset) { + int ret; + zend_class_entry *old_scope = *scope; + *scope = prop_info->ce; + ret = zval_update_constant(pp, (void*)1 TSRMLS_CC); + *scope = old_scope; + return ret; + } + } + ce = ce->parent; + } while (ce); + + } + return zval_update_constant(pp, (void*)1 TSRMLS_CC); } - return zval_update_constant(pp, (void*)1 TSRMLS_CC); } return 0; } |