[BUGFIX] Subrequests can't be resolved
authorNicole Cordes <n.cordes@biz-design.biz>
Fri, 24 Aug 2012 23:17:29 +0000 (01:17 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 26 Aug 2012 09:31:25 +0000 (11:31 +0200)
This patch fixes the resolution of the controller object name when using
widget controller.

Change-Id: I003e7d6c7893b3519252f69b097375b741c5cf73
Fixes: #40157
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14059
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Mvc/Request.php

index 700ada9..4ef6710 100644 (file)
@@ -171,17 +171,20 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
         */
        public function setControllerObjectName($controllerObjectName) {
                $matches = array();
-               preg_match('/
-                       ^Tx
-                       _(?P<extensionName>[^_]+)
-                       _
-                       (
-                               Controller
-                       |
-                               (?P<subpackageKey>.+)_Controller
-                       )
-                       _(?P<controllerName>[a-z_]+)Controller
-                       $/ix', $controllerObjectName, $matches);
+               if (strpos($controllerObjectName, '\\') !== FALSE) {
+                       if (substr($controllerObjectName, 0, 9) === 'TYPO3\CMS') {
+                               $extensionName = '^[^\\\]+\\\[^\\\]+\\\(?P<extensionName>[^\\\]+)';
+                       } else {
+                               $extensionName = '^[^\\\]+\\\(?P<extensionName>[^\\\]+)';
+                       }
+                       preg_match('/' .
+                               $extensionName.'\\\(Controller|(?P<subpackageKey>.+)\\\Controller)\\\(?P<controllerName>[a-z\\\]+)Controller
+                               $/ix', $controllerObjectName, $matches);
+               } else {
+                       preg_match('/
+                               ^Tx_(?P<extensionName>[^_]+)_(Controller|(?P<subpackageKey>.+)_Controller)_(?P<controllerName>[a-z_]+)Controller
+                               $/ix', $controllerObjectName, $matches);
+               }
                $this->controllerExtensionName = $matches['extensionName'];
                $this->controllerSubpackageKey = isset($matches['subpackageKey']) ? $matches['subpackageKey'] : NULL;
                $this->controllerName = $matches['controllerName'];