diff options
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 865cdfc1dc..143ca3589e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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) { - if (value) { - zval *property; + zval *property; - ALLOC_ZVAL(property); + ALLOC_ZVAL(property); + if (value) { *property = value->u.constant; - 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); - 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; - } + } 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); + 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); } |