diff options
author | RFD <rfdy@users.noreply.github.com> | 2015-01-13 15:12:25 -0500 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2016-04-01 21:33:14 +0200 |
commit | ada90d3b0a10249d0bff73a71f81da9b3627dd75 (patch) | |
tree | 5e221d0d37205913bb63b2c3e9dff9b86b5faa85 /phpBB/phpbb/controller | |
parent | Merge pull request #4255 from CHItA/ticket/14393 (diff) | |
download | phpbb-ada90d3b0a10249d0bff73a71f81da9b3627dd75.tar.gz phpbb-ada90d3b0a10249d0bff73a71f81da9b3627dd75.tar.bz2 phpbb-ada90d3b0a10249d0bff73a71f81da9b3627dd75.zip |
[ticket/13502] Controller resolver should handle callable functions and objects
PHPBB3-13502
Diffstat (limited to 'phpBB/phpbb/controller')
-rw-r--r-- | phpBB/phpbb/controller/resolver.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 4f432c3323..233e2e94a4 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -126,9 +126,18 @@ class resolver implements ControllerResolverInterface */ public function getArguments(Request $request, $controller) { - // At this point, $controller contains the object and method name - list($object, $method) = $controller; - $mirror = new \ReflectionMethod($object, $method); + // 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); + } $arguments = array(); $parameters = $mirror->getParameters(); |