Fix the bug where the declared properties without init values were not

entered into the table.
This commit is contained in:
Andrei Zmievski 2002-02-14 04:01:53 +00:00
parent e305585605
commit 68a82f14a2

View file

@ -1966,23 +1966,27 @@ void zend_do_end_class_declaration(znode *class_token TSRMLS_DC)
void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC) void zend_do_declare_property(znode *var_name, znode *value, int declaration_type TSRMLS_DC)
{ {
zval *property;
ALLOC_ZVAL(property);
if (value) { if (value) {
zval *property;
ALLOC_ZVAL(property);
*property = value->u.constant; *property = value->u.constant;
switch (declaration_type) { } else {
case T_VAR: INIT_PZVAL(property);
zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); property->type = IS_NULL;
break; }
case T_STATIC:
zend_hash_update(CG(active_class_entry)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); switch (declaration_type) {
break; case T_VAR:
case T_CONST: zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); break;
break; case T_STATIC:
} zend_hash_update(CG(active_class_entry)->static_members, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
break;
case T_CONST:
zend_hash_update(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
break;
} }
FREE_PNODE(var_name); FREE_PNODE(var_name);
} }