cvs: ZendEngine2 / zend_compile.c
| From: | Andrei Zmievski | Date: | Thu, 14 Feb 2002 04:01:58 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9371@lists.php.net to get a copy of this message | ||
andrei Wed Feb 13 23:01:58 2002 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Fix the bug where the declared properties without init values were not
entered into the table.
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.269 ZendEngine2/zend_compile.c:1.270
--- ZendEngine2/zend_compile.c:1.269 Wed Feb 13 14:26:07 2002
+++ ZendEngine2/zend_compile.c Wed Feb 13 23:01:53 2002
@@ -1966,23 +1966,27 @@
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);
}