diff options
author | Jakub Zelenka <bukka@php.net> | 2015-02-08 14:08:31 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2015-02-08 14:08:31 +0000 |
commit | f2825042b4dd9aa941a080c027f15f41c1b9e4bc (patch) | |
tree | 2e7d97c1dfd4aeabb506ffdd206a612b82adea8d /Zend/zend_API.c | |
parent | 0a81f9a0bd36deac8707949acbcf92f612b60e8e (diff) | |
parent | ce9f52adcdfb19f70dc4274f3587e58ac07995bd (diff) | |
download | php-git-f2825042b4dd9aa941a080c027f15f41c1b9e4bc.tar.gz |
Merge branch 'master' into jsond
Conflicts:
ext/json/json.c
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 440e96d311..69327778e3 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2002,6 +2002,13 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio internal_function->num_args--; } if (info->type_hint) { + if (info->class_name) { + ZEND_ASSERT(info->type_hint == IS_OBJECT); + if (!strcasecmp(info->class_name, "self") && !scope) { + zend_error(E_CORE_ERROR, "Cannot declare a return type of self outside of a class scope"); + } + } + internal_function->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE; } } else { @@ -2086,12 +2093,16 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio __tostring = reg_function; } else if (zend_string_equals_literal(lowercase_name, ZEND_GET_FUNC_NAME)) { __get = reg_function; + scope->ce_flags |= ZEND_ACC_USE_GUARDS; } else if (zend_string_equals_literal(lowercase_name, ZEND_SET_FUNC_NAME)) { __set = reg_function; + scope->ce_flags |= ZEND_ACC_USE_GUARDS; } else if (zend_string_equals_literal(lowercase_name, ZEND_UNSET_FUNC_NAME)) { __unset = reg_function; + scope->ce_flags |= ZEND_ACC_USE_GUARDS; } else if (zend_string_equals_literal(lowercase_name, ZEND_ISSET_FUNC_NAME)) { __isset = reg_function; + scope->ce_flags |= ZEND_ACC_USE_GUARDS; } else if (zend_string_equals_literal(lowercase_name, ZEND_DEBUGINFO_FUNC_NAME)) { __debugInfo = reg_function; } else { @@ -2202,6 +2213,18 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __debugInfo->common.function_name->val); } } + + if (ctor && ctor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && ctor->common.fn_flags & ZEND_ACC_CTOR) { + zend_error(E_CORE_ERROR, "Constructor %s::%s() cannot declare a return type", scope->name->val, ctor->common.function_name->val); + } + + if (dtor && dtor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && dtor->common.fn_flags & ZEND_ACC_DTOR) { + zend_error(E_CORE_ERROR, "Destructor %s::%s() cannot declare a return type", scope->name->val, dtor->common.function_name->val); + } + + if (clone && clone->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && dtor->common.fn_flags & ZEND_ACC_DTOR) { + zend_error(E_CORE_ERROR, "%s::%s() cannot declare a return type", scope->name->val, clone->common.function_name->val); + } efree((char*)lc_class_name); } return SUCCESS; |