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,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)
|
||||
{
|
||||
if (value) {
|
||||
zval *property;
|
||||
|
||||
ALLOC_ZVAL(property);
|
||||
|
||||
if (value) {
|
||||
*property = value->u.constant;
|
||||
} else {
|
||||
INIT_PZVAL(property);
|
||||
property->type = IS_NULL;
|
||||
}
|
||||
|
||||
switch (declaration_type) {
|
||||
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);
|
||||
|
@ -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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FREE_PNODE(var_name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue