mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 00:25:19 +02:00
[ticket/13502] Controller resolver should handle callable functions and objects
PHPBB3-13502
This commit is contained in:
parent
f9b6086302
commit
ada90d3b0a
@ -126,9 +126,18 @@ class resolver implements ControllerResolverInterface
|
|||||||
*/
|
*/
|
||||||
public function getArguments(Request $request, $controller)
|
public function getArguments(Request $request, $controller)
|
||||||
{
|
{
|
||||||
// At this point, $controller contains the object and method name
|
// At this point, $controller should be a callable
|
||||||
list($object, $method) = $controller;
|
if (is_array($controller))
|
||||||
$mirror = new \ReflectionMethod($object, $method);
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
$parameters = $mirror->getParameters();
|
$parameters = $mirror->getParameters();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user