-
Improvement
-
Resolution: Fixed
-
Major
-
3.2.0-dev
-
None
-
None
Implementing Symfony kernel's kernel.controller allows client to change the controller as needed.
If the method calls
$event->setController(function() use ($e) {
|
return new Response($e->getMessage());
|
});
|
Then an error is generated because \phpbb\controller\resolver::getArguments expects controller to be an array rather than any callable, which is functionality that Symfony supports.
The following code fixes this issue:
public function getArguments(Request $request, $controller)
|
{
|
// At this point, $controller should be a callable
|
if (is_array($controller))
|
{
|
list($object, $method) = $controller;
|
$mirror = new \ReflectionMethod($object, $method);
|
} else if (is_object($controller) && !$controller instanceof \Closure)
|
{
|
$mirror = new \ReflectionObject($controller);
|
$mirror = $mirror->getMethod('__invoke');
|
} else {
|
$mirror = new \ReflectionFunction($controller);
|
}
|