Edit report at https://bugs.php.net/bug.php?id=63857&edit=1
ID: 63857 Updated by: re...@php.net Reported by: alexander dot moldova at gmail dot com Summary: calling closure when providing it as an arg from the args array -Status: Open +Status: Not a bug Type: Bug Package: Reflection related Operating System: ubuntu 12.10 PHP Version: 5.4.10 Block user comment: N Private report: N New Comment: >From the error message, the closure declared like: function(array $param); see http://php.net/call_user_func_array so : call_user_func_array($b, $c) + $a; <=> call_user_func_array($b, array(2)) + 0; and <=> $closure(2); 2 is not an array Previous Comments: ------------------------------------------------------------------------ [2012-12-26 15:32:04] alexander dot moldova at gmail dot com Description: ------------ calling closure when providing it as an arg from the args array provided as the second parameter for the invokeArgs method from \ReflectionMethod class Test script: --------------- method is: public function simpleTest($a, callable $b, array $c) { return (int) call_user_func_array($b, $c) + $a; } $params is: array (size=3) 0 => int 2 1 => object(Closure)[95] 2 => array (size=1) 0 => int 2 and calling: $this->refl->invokeArgs(new Blablabla, $params); will generate the bug Expected result: ---------------- method returning value Actual result: -------------- Error: Argument 1 passed to {closure}() must be of the type array, integer given In fact instead or the array is provided the "int 2" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63857&edit=1