summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2014-02-17 19:37:55 -0800
committerSara Golemon <pollita@php.net>2014-02-17 19:37:55 -0800
commit837af6727111e34fea91472d60d1ab5b32d865c3 (patch)
tree93a2ded757e70643ff6fadc2a07b889d445b7765 /Zend/zend_API.c
parent491d492adab851dc8d4e87c3f91c9a00f6d072a8 (diff)
parent1e752ce9c57310cced0a5ba8399778c1f500f2b4 (diff)
downloadphp-git-837af6727111e34fea91472d60d1ab5b32d865c3.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: Add __debugInfo() magic method
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 553060e0a0..5b9279124a 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2018,6 +2018,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, 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, ZEND_DEBUGINFO_FUNC_NAME);
}
}
/* }}} */
@@ -2031,7 +2034,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;
const char *lowercase_name;
int fname_len;
const char *lc_class_name = NULL;
@@ -2180,6 +2183,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, 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, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1)) {
+ __debugInfo = reg_function;
} else {
reg_function = NULL;
}
@@ -2218,6 +2223,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) {
@@ -2281,6 +2287,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, __debugInfo->common.function_name);
+ }
+ }
efree((char*)lc_class_name);
}
return SUCCESS;