Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No arguments are passed to beforeMatch handler in Phalcon\Mvc\Router #1672

Merged
merged 3 commits into from Dec 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ext/mvc/router.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
25 changes: 25 additions & 0 deletions ext/tests/issue-1556.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Missing arguments 1, 2 for closure in beforeMatch - https://github.com/phalcon/cphalcon/issues/1556
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php

$router = new \Phalcon\Mvc\Router(false);

$router->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