uint name_length;
struct _zend_class_entry *parent;
int *refcount;
+ zend_bool constants_updated;
HashTable function_table;
HashTable default_properties;
}
-static void zval_update_const_and_ref(zval **p)
-{
- zval_update_constant(*p);
- zval_add_ref(p);
-}
-
-
-
ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
{
zval *tmp;
+ if (!class_type->constants_updated) {
+ zend_hash_apply(&class_type->default_properties, (int (*)(void *)) zval_update_constant);
+ class_type->constants_updated = 1;
+ }
arg->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
zend_hash_init(arg->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0);
- zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_update_const_and_ref, (void *) &tmp, sizeof(zval *));
+ zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
arg->type = IS_OBJECT;
arg->value.obj.ce = class_type;
return SUCCESS;
CG(class_entry).name_length = class_name->u.constant.value.str.len;
CG(class_entry).refcount = (int *) emalloc(sizeof(int));
*CG(class_entry).refcount = 1;
+ CG(class_entry).constants_updated = 0;
zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
ZEND_API inline void safe_free_zval_ptr(zval *p);
ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC);
ZEND_API inline int i_zend_is_true(zval *op);
-ZEND_API void zval_update_constant(zval *p);
+ZEND_API int zval_update_constant(zval **pp);
ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC);
/* dedicated Zend executor functions - do not use! */
}
-ZEND_API void zval_update_constant(zval *p)
+ZEND_API int zval_update_constant(zval **pp)
{
+ zval *p = *pp;
+
if (p->type == IS_CONSTANT) {
zval c;
int refcount = p->refcount;
}
INIT_PZVAL(p);
p->refcount = refcount;
+ } else if (p->type == IS_ARRAY) {
+ zend_hash_apply(p->value.ht, (int (*)(void *)) zval_update_constant);
}
+ return 0;
}