com php-src: Don't copy args in Closure::__invoke() : Zend/zend_closures.c

From: Date: Sat, 16 Apr 2016 12:47:27 +0000
Subject: com php-src: Don't copy args in Closure::__invoke() : Zend/zend_closures.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91739@lists.php.net to get a copy of this message
Commit: 8c5861e6c650a2d6b8044151b2f71b6b6fcc024c Author: Nikita Popov <nikic@php.net> Sat, 16 Apr 2016 14:47:27 +0200 Parents: fea04a528bd66f6dc678e5272e7598543ea40d09 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8c5861e6c650a2d6b8044151b2f71b6b6fcc024c Log: Don't copy args in Closure::__invoke() Changed paths: M Zend/zend_closures.c Diff: diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index ce392e6..a00d000 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -52,17 +52,11 @@ static zend_object_handlers closure_handlers; ZEND_METHOD(Closure, __invoke) /* {{{ */ { zend_function *func = EX(func); - zval *arguments; + zval *arguments = ZEND_CALL_ARG(execute_data, 1); - arguments = emalloc(sizeof(zval) * ZEND_NUM_ARGS()); - if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) { - efree(arguments); - zend_throw_error(NULL, "Cannot get arguments for calling closure"); - RETVAL_FALSE; - } else if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL) == FAILURE) { + if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL) == FAILURE) { RETVAL_FALSE; } - efree(arguments); /* destruct the function also, then - we have allocated it in get_method */ zend_string_release(func->internal_function.function_name);

« previous php.cvs (#91739) next »