From 520097b065341943363cf9ee968d78213a8d0e57 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 24 Nov 2004 19:56:54 +0000 Subject: [PATCH] - Fix Bug #30856 (ReflectionClass::getStaticProperties segfaults) --- Zend/zend_reflection_api.c | 7 +++++++ ext/reflection/php_reflection.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 771d4101a4..73da40d62e 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -2295,6 +2295,13 @@ ZEND_METHOD(reflection_class, getStaticProperties) METHOD_NOTSTATIC_NUMPARAMS(0); GET_REFLECTION_OBJECT_PTR(ce); + + if (!ce->constants_updated) { + zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); + zend_hash_apply_with_argument(ce->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); + ce->constants_updated = 1; + } + array_init(return_value); zend_hash_copy(Z_ARRVAL_P(return_value), ce->static_members, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 771d4101a4..73da40d62e 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2295,6 +2295,13 @@ ZEND_METHOD(reflection_class, getStaticProperties) METHOD_NOTSTATIC_NUMPARAMS(0); GET_REFLECTION_OBJECT_PTR(ce); + + if (!ce->constants_updated) { + zend_hash_apply_with_argument(&ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); + zend_hash_apply_with_argument(ce->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); + ce->constants_updated = 1; + } + array_init(return_value); zend_hash_copy(Z_ARRVAL_P(return_value), ce->static_members, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); } -- 2.50.1