diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-86184-ProtectedMethodsInReportController.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-86184-ProtectedMethodsInReportController.rst new file mode 100644 index 0000000000000000000000000000000000000000..e7acbccc943d7b77e03f124b4d3116f0465712f1 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-86184-ProtectedMethodsInReportController.rst @@ -0,0 +1,36 @@ +.. include:: ../../Includes.txt + +=========================================================== +Deprecation: #86184 - Protected methods in ReportController +=========================================================== + +See :issue:`86184` + +Description +=========== + +The following methods of class :php:`TYPO3\CMS\Reports\Controller\ReportController` +changed their visibility from public to protected and should not be called any longer: + +* :php:`indexAction()` +* :php:`detailAction()` + +Impact +====== + +Calling one of the above methods from an external object triggers a PHP :php:`E_USER_DEPRECATED` error. + + +Affected Installations +====================== + +Both methods are called internally only. Extensions extending the reports module +using the normal reports API are not affected by this. + + +Migration +========= + +No migration possible. + +.. index:: Backend, PHP-API, NotScanned, ext:reports \ No newline at end of file diff --git a/typo3/sysext/reports/Classes/Controller/ReportController.php b/typo3/sysext/reports/Classes/Controller/ReportController.php index 899c9a9d50d32e5870668a83ee98b2bc8d16c73c..f946604143a80b0626cb20208b21b3394753d13d 100644 --- a/typo3/sysext/reports/Classes/Controller/ReportController.php +++ b/typo3/sysext/reports/Classes/Controller/ReportController.php @@ -19,6 +19,7 @@ use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Template\ModuleTemplate; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait; use TYPO3\CMS\Core\Http\HtmlResponse; use TYPO3\CMS\Core\Http\RedirectResponse; use TYPO3\CMS\Core\Localization\LanguageService; @@ -33,6 +34,16 @@ use TYPO3Fluid\Fluid\View\ViewInterface; */ class ReportController { + use PublicMethodDeprecationTrait; + + /** + * @var array + */ + private $deprecatedPublicMethods = [ + 'indexAction' => 'Using ReportController::indexAction() is deprecated and will not be possible anymore in TYPO3 v10.', + 'detailAction' => 'Using ReportController::detailAction() is deprecated and will not be possible anymore in TYPO3 v10.', + ]; + /** * ModuleTemplate object * @@ -68,12 +79,11 @@ class ReportController */ public function handleRequest(ServerRequestInterface $request): ResponseInterface { - $actionDefault = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action']; - $action = $actionDefault ?: 'index'; + $action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? 'index'; $extension = $request->getQueryParams()['extension'] ?? $request->getParsedBody()['extension']; $isRedirect = $request->getQueryParams()['redirect'] ?? $request->getParsedBody()['redirect'] ?? false; - if ($actionDefault !== 'index' && !$isRedirect && !$extension + if ($action !== 'index' && !$isRedirect && !$extension && is_array($GLOBALS['BE_USER']->uc['reports']['selection'])) { $previousSelection = $GLOBALS['BE_USER']->uc['reports']['selection']; if (!empty($previousSelection['extension']) && !empty($previousSelection['report'])) { @@ -89,9 +99,15 @@ class ReportController $this->initializeView($action); - $result = call_user_func_array([$this, $action . 'Action'], [$request]); - if ($result instanceof ResponseInterface) { - return $result; + if ($action === 'index') { + $this->indexAction(); + } elseif ($action === 'detail') { + $this->detailAction($request); + } else { + throw new \RuntimeException( + 'Reports module has only "index" and "detail" action, ' . (string)$action . ' given', + 1536322935 + ); } $this->generateMenu($request); @@ -117,7 +133,7 @@ class ReportController /** * Overview */ - public function indexAction() + protected function indexAction() { $this->view->assign('reports', $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']); $this->saveState(); @@ -128,7 +144,7 @@ class ReportController * * @param ServerRequestInterface $request */ - public function detailAction(ServerRequestInterface $request) + protected function detailAction(ServerRequestInterface $request) { $content = $error = ''; $extension = $request->getQueryParams()['extension'] ?? $request->getParsedBody()['extension'];