diff options
author | Marcus Boerger <helly@php.net> | 2003-09-03 18:01:22 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-09-03 18:01:22 +0000 |
commit | 7bbbd5035d316754c1eb9daefaec8d574456491a (patch) | |
tree | 8af63a665bfdaca04fddbec9b469c4ad15fe2862 | |
parent | 4ff5341fb0b194033c5fe35fa6bf73555c342560 (diff) | |
download | php-git-7bbbd5035d316754c1eb9daefaec8d574456491a.tar.gz |
Fix handling of static properties initialized to arrays
-rw-r--r-- | Zend/zend_API.c | 16 | ||||
-rw-r--r-- | Zend/zend_API.h | 10 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 | ||||
-rw-r--r-- | Zend/zend_default_classes.c | 12 | ||||
-rw-r--r-- | Zend/zend_exceptions.c | 12 |
5 files changed, 27 insertions, 25 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index fdb2d6899a..e95be0838c 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -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) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 4bbc3c2e09..c68c2814c7 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -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))) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 53137ea675..07cab637fb 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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); } diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index a8048200ca..c83b007f8f 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -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) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index a8048200ca..c83b007f8f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -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) |