summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2005-01-22 12:23:01 +0000
committerMarcus Boerger <helly@php.net>2005-01-22 12:23:01 +0000
commit1d5c13bdad8416d96f22ce1e0da9b3dfba7c8fe5 (patch)
tree3923274d9cc0325b7838089764833e34ad2895ca /Zend/zend_API.c
parentbad986232bd56d920ef9edf10314ff3c02eee2ee (diff)
downloadphp-git-1d5c13bdad8416d96f22ce1e0da9b3dfba7c8fe5.tar.gz
- Fix #31651 (ReflectionClass::getDefaultProperties segfaults with arrays.)
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 63b97fea7e..f59261cf43 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -709,6 +709,16 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
}
+ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC)
+{
+ if (!class_type->constants_updated) {
+ zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
+ zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
+ class_type->constants_updated = 1;
+ }
+}
+
+
/* This function requires 'properties' to contain all props declared in the
* class and all props being public. If only a subset is given or the class
* has protected members then you need to merge the properties seperately by
@@ -723,11 +733,7 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
zend_error(E_ERROR, "Cannot instantiate %s %s", what, class_type->name);
}
- if (!class_type->constants_updated) {
- zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
- class_type->constants_updated = 1;
- }
+ zend_update_class_constants(class_type TSRMLS_CC);
arg->type = IS_OBJECT;
if (class_type->create_object == NULL) {