From: Nikita Popov Date: Fri, 29 May 2015 09:11:02 +0000 (+0200) Subject: Merge branch 'PHP-5.6' X-Git-Tag: PRE_PHP7_NSAPI_REMOVAL~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39753fa222b42d806bb622bac22e27b4381ff099;p=php Merge branch 'PHP-5.6' Preserving HAS_RETURN_TYPE for __invoke() here as well. Conflicts: Zend/zend_alloc.c --- 39753fa222b42d806bb622bac22e27b4381ff099 diff --cc Zend/zend_closures.c index e656f8d6ca,90d7eaf8c0..2eeaec639d --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@@ -199,18 -144,16 +199,21 @@@ static int zend_closure_compare_objects } /* }}} */ -ZEND_API zend_function *zend_get_closure_invoke_method(zval *obj TSRMLS_DC) /* {{{ */ +ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object) /* {{{ */ { - zend_closure *closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC); + zend_closure *closure = (zend_closure *)object; zend_function *invoke = (zend_function*)emalloc(sizeof(zend_function)); - const zend_uint keep_flags = ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC; ++ const uint32_t keep_flags = ++ ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC | ZEND_ACC_HAS_RETURN_TYPE; invoke->common = closure->func.common; + /* We return ZEND_INTERNAL_FUNCTION, but arg_info representation is the + * same as for ZEND_USER_FUNCTION (uses zend_string* instead of char*). + * This is not a problem, because ZEND_ACC_HAS_TYPE_HINTS is never set, + * and we won't check arguments on internal function */ invoke->type = ZEND_INTERNAL_FUNCTION; - invoke->internal_function.fn_flags = ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & ZEND_ACC_RETURN_REFERENCE); + invoke->internal_function.fn_flags = + ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); invoke->internal_function.handler = ZEND_MN(Closure___invoke); invoke->internal_function.module = 0; invoke->internal_function.scope = zend_ce_closure;