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,12 +1966,17 @@ 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)
{ {
if (value) {
zval *property; zval *property;
ALLOC_ZVAL(property); ALLOC_ZVAL(property);
if (value) {
*property = value->u.constant; *property = value->u.constant;
} else {
INIT_PZVAL(property);
property->type = IS_NULL;
}
switch (declaration_type) { switch (declaration_type) {
case T_VAR: case T_VAR:
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)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL);
@ -1983,7 +1988,6 @@ void zend_do_declare_property(znode *var_name, znode *value, int declaration_typ
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); 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;
} }
}
FREE_PNODE(var_name); FREE_PNODE(var_name);
} }