diff --git a/CHANGELOG b/CHANGELOG index db10f2326fc..9571621db2c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -179,6 +179,7 @@ - Added Phalcon\Mvc\Model::selectWriteConnection() (#1519) - Added Phalcon\Mvc\Router\Group::convert()/getConverters() (#1555, #1572) - Faster Phalcon\Mvc\Model\Row (#1606) + - Bug fix: no arguments were passed to beforeMatch handler in Phalcon\Mvc\Router (#1556) - Phalcon\Flash: - Phalcon\Flash\Session::getMessage('key') returns now an empty array if the key is not found (#908, #920) - Phalcon\Flash\Session::getMessages() incorrectly removed all messages (#1575) diff --git a/ext/mvc/router.c b/ext/mvc/router.c index 5dfb5e9e477..75f48299c5d 100644 --- a/ext/mvc/router.c +++ b/ext/mvc/router.c @@ -714,7 +714,7 @@ PHP_METHOD(Phalcon_Mvc_Router, handle){ * Call the function in the PHP userland */ PHALCON_INIT_NVAR(route_found); - PHALCON_CALL_USER_FUNC_ARRAY(route_found, before_match, params); + PHALCON_CALL_USER_FUNC_ARRAY(route_found, before_match, before_match_params); } } diff --git a/ext/tests/issue-1556.phpt b/ext/tests/issue-1556.phpt new file mode 100644 index 00000000000..4172dc54894 --- /dev/null +++ b/ext/tests/issue-1556.phpt @@ -0,0 +1,25 @@ +--TEST-- +Missing arguments 1, 2 for closure in beforeMatch - https://github.com/phalcon/cphalcon/issues/1556 +--SKIPIF-- + +--FILE-- +add('/test')->beforeMatch( + function($uri, $route, $router) + { + echo $uri, PHP_EOL; + echo get_class($route), PHP_EOL; + echo get_class($router), PHP_EOL; + return true; + } +); + +$router->handle('/test'); +?> +--EXPECT-- +/test +Phalcon\Mvc\Router\Route +Phalcon\Mvc\Router