cvs: ZendEngine2 / zend_API.c zend_API.h zend_reflection_api.c

From: Date: Sat, 22 Jan 2005 12:23:02 +0000
Subject: cvs: ZendEngine2 / zend_API.c zend_API.h zend_reflection_api.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3323@lists.php.net to get a copy of this message
helly Sat Jan 22 07:23:02 2005 EDT Modified files: /ZendEngine2 zend_API.c zend_API.h zend_reflection_api.c Log: - Fix #31651 (ReflectionClass::getDefaultProperties segfaults with arrays.) http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.271&r2=1.272&ty=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.271 ZendEngine2/zend_API.c:1.272 --- ZendEngine2/zend_API.c:1.271 Fri Jan 14 19:11:20 2005 +++ ZendEngine2/zend_API.c Sat Jan 22 07:23:01 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.271 2005/01/15 00:11:20 andi Exp $ */ +/* $Id: zend_API.c,v 1.272 2005/01/22 12:23:01 helly Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -709,6 +709,16 @@ } +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_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) { http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.192&r2=1.193&ty=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.192 ZendEngine2/zend_API.h:1.193 --- ZendEngine2/zend_API.h:1.192 Mon Oct 4 16:17:04 2004 +++ ZendEngine2/zend_API.h Sat Jan 22 07:23:01 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.192 2004/10/04 20:17:04 andi Exp $ */ +/* $Id: zend_API.h,v 1.193 2005/01/22 12:23:01 helly Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -191,6 +191,7 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC); +ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC); ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC); ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC); ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC); http://cvs.php.net/diff.php/ZendEngine2/zend_reflection_api.c?r1=1.144&r2=1.145&ty=u Index: ZendEngine2/zend_reflection_api.c diff -u ZendEngine2/zend_reflection_api.c:1.144 ZendEngine2/zend_reflection_api.c:1.145 --- ZendEngine2/zend_reflection_api.c:1.144 Mon Dec 27 10:13:26 2004 +++ ZendEngine2/zend_reflection_api.c Sat Jan 22 07:23:01 2005 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_reflection_api.c,v 1.144 2004/12/27 15:13:26 helly Exp $ */ +/* $Id: zend_reflection_api.c,v 1.145 2005/01/22 12:23:01 helly Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_exceptions.h" @@ -2296,11 +2296,7 @@ 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; - } + zend_update_class_constants(ce TSRMLS_CC); 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 *)); @@ -2319,6 +2315,8 @@ GET_REFLECTION_OBJECT_PTR(ce); array_init(return_value); + zend_update_class_constants(ce TSRMLS_CC); + count = zend_hash_num_elements(&ce->default_properties); if (count > 0) { HashPosition pos;

« previous php.zend-engine.cvs (#3323) next »