Skip to content
Snippets Groups Projects
Commit c00c50ee authored by Sascha Egerer's avatar Sascha Egerer
Browse files

[BUGFIX] Initialize attribute in RequestBuilder with correct type

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/45293


Reviewed-by: default avatarSascha Egerer <sascha@sascha-egerer.de>
Tested-by: default avatarSascha Egerer <sascha@sascha-egerer.de>
parent 766262fe
Branches
Tags
No related merge requests found
......@@ -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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment