Re: cvs: ZendEngine2 / zend_compile.c

From: Date: Thu, 14 Feb 2002 05:26:14 +0000
Subject: Re: cvs: ZendEngine2 / zend_compile.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9372@lists.php.net to get a copy of this message
You know that isset() will return false for these. Are you sure this fixes your problem? Andi At 04:01 AM 2/14/2002 +0000, Andrei Zmievski wrote:
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);
} -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#9372) next »