]> granicus.if.org Git - php/commitdiff
Fix handling of static properties initialized to arrays
authorMarcus Boerger <helly@php.net>
Wed, 3 Sep 2003 18:01:22 +0000 (18:01 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 3 Sep 2003 18:01:22 +0000 (18:01 +0000)
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_compile.c
Zend/zend_default_classes.c
Zend/zend_exceptions.c

index fdb2d6899a970104f3e0fd58143e183a92da25c5..e95be0838c7897d99c4dfe4d141e078d7e078d93 100644 (file)
@@ -1659,7 +1659,7 @@ ZEND_API char *zend_get_module_version(char *module_name)
 }
 
 
-ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type)
+ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC)
 {
        zend_property_info property_info;
        HashTable *target_symbol_table;
@@ -1683,6 +1683,8 @@ ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_le
                        default:
                                break;
                }
+       } else {
+               zval_update_constant(&property, (void *) 1 TSRMLS_CC);
        }
        switch (access_type & ZEND_ACC_PPP_MASK) {
                case ZEND_ACC_PRIVATE: {
@@ -1727,7 +1729,7 @@ ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_le
        return SUCCESS;
 }
 
-ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type)
+ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC)
 {
        zval *property;
        
@@ -1737,10 +1739,10 @@ ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int na
                ALLOC_ZVAL(property);
        }
        INIT_ZVAL(*property);
-       return zend_declare_property(ce, name, name_length, property, access_type);
+       return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
 }
 
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type)
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC)
 {
        zval *property;
        
@@ -1751,10 +1753,10 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int na
        }
        INIT_PZVAL(property);
        ZVAL_LONG(property, value);
-       return zend_declare_property(ce, name, name_length, property, access_type);
+       return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
 }
 
-ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type)
+ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC)
 {
        zval *property;
        int len = strlen(value);
@@ -1767,7 +1769,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
                ZVAL_STRINGL(property, value, len, 1);
        }
        INIT_PZVAL(property);
-       return zend_declare_property(ce, name, name_length, property, access_type);
+       return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
 }
 
 ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
index 4bbc3c2e09809dbf84f72fda3c31f5a348b6a277..c68c2814c73412950a34e57a308c803be5562f70 100644 (file)
@@ -165,10 +165,10 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
 ZEND_API void zend_wrong_param_count(TSRMLS_D);
 ZEND_API zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callable_name);
 ZEND_API char *zend_get_module_version(char *module_name);
-ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type);
-ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type);
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type);
-ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type);
+ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
 
 ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
 ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
@@ -473,7 +473,7 @@ ZEND_API ZEND_FUNCTION(display_disabled_class);
 {                                                                                                                                                                      \
        char *_name = (name);                                                                                                                   \
        int namelen = strlen(_name);                                                                                                    \
-       zend_declare_property(class_ptr, _name, namelen, value, mask);          \
+       zend_declare_property(class_ptr, _name, namelen, value, mask TSRMLS_CC);                \
 }
 
 #define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p) TSRMLS_CC) : NULL)))
index 53137ea675edc0997d9f698b189217b9b7c3888b..07cab637fb2162bc77486f9dd4e49ddef010793a 100644 (file)
@@ -2407,7 +2407,7 @@ void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_ty
                property->type = IS_NULL;
        }
 
-       zend_declare_property(CG(active_class_entry), var_name->u.constant.value.str.val, var_name->u.constant.value.str.len, property, access_type);
+       zend_declare_property(CG(active_class_entry), var_name->u.constant.value.str.val, var_name->u.constant.value.str.len, property, access_type TSRMLS_CC);
        efree(var_name->u.constant.value.str.val);
 }
 
index a8048200ca3ed6f28eebeb57f5904e1f61c57710..c83b007f8f80e434f61d15e97f1eebab40856a40 100644 (file)
@@ -364,12 +364,12 @@ static void zend_register_default_exception(TSRMLS_D)
        default_exception_ptr = zend_register_internal_class(&ce TSRMLS_CC);
        default_exception_ptr->create_object = zend_default_exception_new;
 
-       zend_declare_property_string(default_exception_ptr, "message", sizeof("message")-1, "Unknown exception", ZEND_ACC_PROTECTED);
-       zend_declare_property_string(default_exception_ptr, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE);
-       zend_declare_property_long(default_exception_ptr, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED);
+       zend_declare_property_string(default_exception_ptr, "message", sizeof("message")-1, "Unknown exception", ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_string(default_exception_ptr, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
+       zend_declare_property_long(default_exception_ptr, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
 }
 
 ZEND_API zend_class_entry *zend_exception_get_default(void)
index a8048200ca3ed6f28eebeb57f5904e1f61c57710..c83b007f8f80e434f61d15e97f1eebab40856a40 100644 (file)
@@ -364,12 +364,12 @@ static void zend_register_default_exception(TSRMLS_D)
        default_exception_ptr = zend_register_internal_class(&ce TSRMLS_CC);
        default_exception_ptr->create_object = zend_default_exception_new;
 
-       zend_declare_property_string(default_exception_ptr, "message", sizeof("message")-1, "Unknown exception", ZEND_ACC_PROTECTED);
-       zend_declare_property_string(default_exception_ptr, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE);
-       zend_declare_property_long(default_exception_ptr, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED);
-       zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED);
+       zend_declare_property_string(default_exception_ptr, "message", sizeof("message")-1, "Unknown exception", ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_string(default_exception_ptr, "string", sizeof("string")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC);
+       zend_declare_property_long(default_exception_ptr, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1, ZEND_ACC_PROTECTED TSRMLS_CC);
 }
 
 ZEND_API zend_class_entry *zend_exception_get_default(void)