summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 9212527963..60ef092bb1 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1128,7 +1128,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
int ret;
zend_class_entry *old_scope = *scope;
*scope = prop_info->ce;
- ret = zval_update_constant(pp, (void*)1 TSRMLS_CC);
+ ret = zval_update_constant(pp, 1 TSRMLS_CC);
*scope = old_scope;
return ret;
}
@@ -1137,7 +1137,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
} while (ce);
}
- return zval_update_constant(pp, (void*)1 TSRMLS_CC);
+ return zval_update_constant(pp, 1 TSRMLS_CC);
}
return 0;
}
@@ -1151,7 +1151,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
int i;
*scope = class_type;
- zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
+ zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void *)1 TSRMLS_CC);
for (i = 0; i < class_type->default_properties_count; i++) {
if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
@@ -2085,6 +2085,9 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce,
!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0
) {
zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_TOSTRING_FUNC_NAME);
+ } else if (name_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1 &&
+ !memcmp(lcname, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && fptr->common.num_args != 0) {
+ zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_DEBUGINFO_FUNC_NAME);
}
}
/* }}} */
@@ -2098,7 +2101,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
int count=0, unload=0;
HashTable *target_function_table = function_table;
int error_type;
- zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL;
+ zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL, *__debugInfo = NULL;
zend_string *lowercase_name;
int fname_len;
const char *lc_class_name = NULL;
@@ -2250,6 +2253,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
__unset = reg_function;
} else if ((fname_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) {
__isset = reg_function;
+ } else if ((fname_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && !memcmp(lowercase_name->val, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) {
+ __debugInfo = reg_function;
} else {
reg_function = NULL;
}
@@ -2289,6 +2294,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
scope->__set = __set;
scope->__unset = __unset;
scope->__isset = __isset;
+ scope->__debugInfo = __debugInfo;
if (ctor) {
ctor->common.fn_flags |= ZEND_ACC_CTOR;
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
@@ -2352,6 +2358,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
+ if (__debugInfo) {
+ if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) {
+ zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __debugInfo->common.function_name->val);
+ }
+ }
efree((char*)lc_class_name);
}
return SUCCESS;