[BUGFIX] Initialize attribute in RequestBuilder with correct type 48/45748/2
authorSascha Egerer <sascha@sascha-egerer.de>
Tue, 15 Dec 2015 17:09:57 +0000 (18:09 +0100)
committerSascha Egerer <sascha@sascha-egerer.de>
Sat, 9 Jan 2016 08:05:04 +0000 (09:05 +0100)
The correct type for `defaultControllerName` is string.
Also cast all assigned values to strings, so a check with
empty() works as expected.

Change-Id: Id04a808bef2aa412ede928e7e1777bc0fcfa1873
Resolves: #72255
Releases: 7.6, master
Reviewed-on: https://review.typo3.org/45748
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php

index e107659..f3f5df6 100644 (file)
@@ -53,7 +53,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
      *
      * @var string
      */
-    protected $defaultControllerName;
+    protected $defaultControllerName = '';
 
     /**
      * The default format of the response object
@@ -136,7 +136,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
         }
         $this->extensionName = $configuration['extensionName'];
         $this->pluginName = $configuration['pluginName'];
-        $this->defaultControllerName = current(array_keys($configuration['controllerConfiguration']));
+        $this->defaultControllerName = (string)current(array_keys($configuration['controllerConfiguration']));
         $this->allowedControllerActions = array();
         foreach ($configuration['controllerConfiguration'] as $controllerName => $controllerActions) {
             $this->allowedControllerActions[$controllerName] = $controllerActions['actions'];
@@ -199,7 +199,7 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface
     protected function resolveControllerName(array $parameters)
     {
         if (!isset($parameters['controller']) || $parameters['controller'] === '') {
-            if ($this->defaultControllerName === '') {
+            if (empty($this->defaultControllerName)) {
                 throw new MvcException('The default controller for extension "' . $this->extensionName . '" and plugin "' . $this->pluginName . '" can not be determined. Please check for TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1316104317);
             }
             return $this->defaultControllerName;