mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Fix the bug where the declared properties without init values were not
entered into the table.
This commit is contained in:
parent
e305585605
commit
68a82f14a2
1 changed files with 19 additions and 15 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue