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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 69327778e3..260b0628b3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2003,9 +2003,17 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
if (info->type_hint) {
if (info->class_name) {
+ uint32_t fetch_type;
+ zend_string *class_name;
+ ALLOCA_FLAG(use_heap);
+
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");
+ STR_ALLOCA_INIT(class_name, info->class_name, strlen(info->class_name), use_heap);
+ fetch_type = zend_get_class_fetch_type(class_name);
+ STR_ALLOCA_FREE(class_name, use_heap);
+
+ if (fetch_type != ZEND_FETCH_CLASS_DEFAULT && !scope) {
+ zend_error(E_CORE_ERROR, "Cannot declare a return type of %s outside of a class scope", info->class_name);
}
}