From 2d9cebbcd218b814788f389a310ce70ea830447d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Uzna=C5=84ski?= <l.uznanski@macopedia.pl> Date: Fri, 16 Mar 2018 18:39:33 +0100 Subject: [PATCH] [TASK] Use ServerRequestInterface in LoginFramesetController * deprecate public properties * deprecate public (non-routed) methods Resolves: #84368 Releases: master Change-Id: Ib3f4724dc77384ece76cc6b3c6b9adee38c595e8 Reviewed-on: https://review.typo3.org/56246 Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de> Tested-by: Mathias Brodala <mbrodala@pagemachine.de> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Controller/LoginFramesetController.php | 27 ++++++++---- ...AndPropertiesInLoginFramesetController.rst | 41 +++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-84368-ProtectedMethodsAndPropertiesInLoginFramesetController.rst diff --git a/typo3/sysext/backend/Classes/Controller/LoginFramesetController.php b/typo3/sysext/backend/Classes/Controller/LoginFramesetController.php index 5228574c8079..a11998915f4c 100644 --- a/typo3/sysext/backend/Classes/Controller/LoginFramesetController.php +++ b/typo3/sysext/backend/Classes/Controller/LoginFramesetController.php @@ -1,4 +1,5 @@ <?php +declare(strict_types = 1); namespace TYPO3\CMS\Backend\Controller; /* @@ -16,6 +17,8 @@ namespace TYPO3\CMS\Backend\Controller; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; +use TYPO3\CMS\Backend\Routing\UriBuilder; +use TYPO3\CMS\Backend\Template\DocumentTemplate; use TYPO3\CMS\Core\Http\HtmlResponse; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -47,20 +50,30 @@ class LoginFramesetController */ public function mainAction(ServerRequestInterface $request): ResponseInterface { - $this->main(); + $this->createFrameset(); return new HtmlResponse($this->content); } - /** * Main function. * Creates the header code and the frameset for the two frames. + * + * @deprecated since v9, will be removed in v10 */ public function main() + { + trigger_error('Method main() will be replaced by protected method createFrameset() in v10. Do not call from other extension', E_USER_DEPRECATED); + $this->createFrameset(); + } + /** + * Main function. + * Creates the header code and the frameset for the two frames. + */ + protected function createFrameset(): void { $title = 'TYPO3 Re-Login (' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ')'; $this->getDocumentTemplate()->startPage($title); - /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */ - $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); + /** @var UriBuilder $uriBuilder */ + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); // Create the frameset for the window $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) . ' <frameset rows="*,1"> @@ -73,9 +86,9 @@ class LoginFramesetController /** * Returns an instance of DocumentTemplate * - * @return \TYPO3\CMS\Backend\Template\DocumentTemplate + * @return DocumentTemplate */ - protected function getDocumentTemplate() + protected function getDocumentTemplate(): DocumentTemplate { return $GLOBALS['TBE_TEMPLATE']; } @@ -83,7 +96,7 @@ class LoginFramesetController /** * @return PageRenderer */ - protected function getPageRenderer() + protected function getPageRenderer(): PageRenderer { return GeneralUtility::makeInstance(PageRenderer::class); } diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84368-ProtectedMethodsAndPropertiesInLoginFramesetController.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84368-ProtectedMethodsAndPropertiesInLoginFramesetController.rst new file mode 100644 index 000000000000..a699375b485a --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84368-ProtectedMethodsAndPropertiesInLoginFramesetController.rst @@ -0,0 +1,41 @@ +.. include:: ../../Includes.txt + +================================================================================= +Deprecation: #84368 - Protected methods and properties in LoginFramesetController +================================================================================= + +See :issue:`84368` + +Description +=========== + +This file is about third party usage (consumer that call the class as well as +signals or hooks depending on it) of :php:`TYPO3\CMS\Backend\Controller\LoginFramesetController`. + +All methods not used as entry points by :php:`TYPO3\CMS\Backend\Http\RouteDispatcher` will be +removed or set to protected in v10 and throw deprecation warnings if used from a third party: + +* [not scanned] :php:`main()` + + +Impact +====== + +Calling above method on an instance of :php:`LoginFramesetController` will throw a deprecation warning in v9 and a PHP fatal in v10. + + +Affected Installations +====================== + +The extension scanner will find all usages, but may also find some false positives. In general all extensions +that set properties or call methods except :php:`mainAction()` are affected. + + +Migration +========= + +In general, extensions should not instantiate and re-use controllers of the core. Existing +usages should be rewritten to be free of calls like these. + + +.. index:: Backend, PHP-API, PartiallyScanned -- GitLab