diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst index 59bccbb542044362243d906105b7641c7db126d6..ca22333954594ad1feec94c0ec8c05b399126c6d 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst @@ -53,6 +53,7 @@ The following methods changed signature according to previous deprecations in v1 - :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl` (arguments 2, 3 and 4 are dropped) - :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService` (arguments 3 :php:`$excludeServiceKeys` is now an array) +- :php:`\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->__construct` The following public class properties have been dropped: diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php index b286ee2f80f715e5c6f3bd393ebee7453cc7adf4..a5a4ae71154dc06a25aa81bc7485a035772f93a8 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php @@ -16,11 +16,16 @@ namespace TYPO3\CMS\Fluid\ViewHelpers; use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Http\ServerRequestFactory; +use TYPO3\CMS\Core\Routing\PageArguments; +use TYPO3\CMS\Core\Site\Entity\SiteInterface; +use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\TimeTracker\TimeTracker; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Reflection\ObjectAccess; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -211,10 +216,27 @@ class CObjectViewHelper extends AbstractViewHelper */ protected static function getContentObjectRenderer() { - return GeneralUtility::makeInstance( - ContentObjectRenderer::class, - $GLOBALS['TSFE'] ?? GeneralUtility::makeInstance(TypoScriptFrontendController::class, GeneralUtility::makeInstance(Context::class)) - ); + if (($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController) { + $tsfe = $GLOBALS['TSFE']; + } else { + $globalRequest = $GLOBALS['TYPO3_REQUEST'] ?? ServerRequestFactory::fromGlobals(); + $site = $globalRequest->getAttribute('site'); + if (!($site instanceof SiteInterface)) { + $sites = GeneralUtility::makeInstance(SiteFinder::class)->getAllSites(); + $site = reset($sites); + } + $language = $globalRequest->getAttribute('language') ?? $site->getDefaultLanguage(); + $pageArguments = $globalRequest->getAttribute('routing') ?? new PageArguments(0, 0, []); + $tsfe = GeneralUtility::makeInstance( + TypoScriptFrontendController::class, + GeneralUtility::makeInstance(Context::class), + $site, + $language, + $pageArguments, + GeneralUtility::makeInstance(FrontendUserAuthentication::class) + ); + } + return GeneralUtility::makeInstance(ContentObjectRenderer::class, $tsfe); } /** diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 25c6d6f0522c08fd972cef062b0384a265cafde5..7f3eefc55c474bca9876ce2ed6a782e2cd4092c1 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -46,7 +46,6 @@ use TYPO3\CMS\Core\Error\Http\ServiceUnavailableException; use TYPO3\CMS\Core\Error\Http\ShortcutTargetPageNotFoundException; use TYPO3\CMS\Core\Exception\Page\RootLineException; use TYPO3\CMS\Core\Http\ImmediateResponseException; -use TYPO3\CMS\Core\Http\ServerRequestFactory; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Locking\Exception\LockAcquireWouldBlockException; use TYPO3\CMS\Core\Locking\LockFactory; @@ -224,9 +223,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface /** * The frontend user * - * @var FrontendUserAuthentication|string + * @var FrontendUserAuthentication */ - public $fe_user = ''; + public $fe_user; /** * Shows whether logins are allowed in branch @@ -693,36 +692,21 @@ class TypoScriptFrontendController implements LoggerAwareInterface * - SiteLanguage * - PageArguments (containing ID, Type, cHash and MP arguments) * - * With TYPO3 v11, they will become mandatory and the method arguments will become strongly typed. - * For TYPO3 v10 this is built in a way to ensure maximum compatibility. - * * Also sets a unique string (->uniqueString) for this script instance; A md5 hash of the microtime() * - * @param Context|array|null $context the Context object to work on, previously defined to set TYPO3_CONF_VARS - * @param mixed|SiteInterface $siteOrId The resolved site to work on, previously this was the value of GeneralUtility::_GP('id') - * @param SiteLanguage|int|string $siteLanguageOrType The resolved language to work on, previously the value of GeneralUtility::_GP('type') - * @param bool|string|PageArguments|null $pageArguments The PageArguments object containing ID, type and GET parameters, previously unused or the value of GeneralUtility::_GP('no_cache') - * @param string|FrontendUserAuthentication|null $cHashOrFrontendUser FrontendUserAuthentication object, previously the value of GeneralUtility::_GP('cHash'), use the PageArguments object instead, will be removed in TYPO3 v11.0 - * @param string|null $_2 previously was used to define the jumpURL, use the PageArguments object instead, will be removed in TYPO3 v11.0 - * @param string|null $MP The value of GeneralUtility::_GP('MP'), use the PageArguments object instead, will be removed in TYPO3 v11.0 + * @param Context $context the Context object to work with + * @param SiteInterface $site The resolved site to work with + * @param SiteLanguage $siteLanguage The resolved language to work with + * @param PageArguments $pageArguments The PageArguments object containing Page ID, type and GET parameters + * @param FrontendUserAuthentication $frontendUser a FrontendUserAuthentication object */ - public function __construct($context = null, $siteOrId = null, $siteLanguageOrType = null, $pageArguments = null, $cHashOrFrontendUser = null, $_2 = null, $MP = null) + public function __construct(Context $context, SiteInterface $site, SiteLanguage $siteLanguage, PageArguments $pageArguments, FrontendUserAuthentication $frontendUser) { - $this->initializeContextWithGlobalFallback($context); - - // Fetch the request for fetching data (site/language/pageArguments) for compatibility reasons, not needed - // in TYPO3 v11.0 anymore. - /** @var ServerRequestInterface $request */ - $request = $GLOBALS['TYPO3_REQUEST'] ?? ServerRequestFactory::fromGlobals(); - - $this->initializeSiteWithCompatibility($siteOrId, $request); - $this->initializeSiteLanguageWithCompatibility($siteLanguageOrType, $request); - $pageArguments = $this->buildPageArgumentsWithFallback($pageArguments, $request); - $pageArguments = $this->initializeFrontendUserOrUpdateCHashArgument($cHashOrFrontendUser, $pageArguments); - $pageArguments = $this->initializeLegacyMountPointArgument($MP, $pageArguments); - + $this->initializeContext($context); + $this->site = $site; + $this->language = $siteLanguage; $this->setPageArguments($pageArguments); - + $this->fe_user = $frontendUser; $this->uniqueString = md5(microtime()); $this->initPageRenderer(); $this->initCaches(); @@ -730,155 +714,14 @@ class TypoScriptFrontendController implements LoggerAwareInterface $this->setOutputLanguage(); } - /** - * Various initialize methods used for fallback, which can be simplified in TYPO3 v11.0 - */ - /** - * Used to set $this->context. The first argument was $GLOBALS[TYPO3_CONF_VARS] (array) until TYPO3 v8, - * so no type hint possible. - * - * @param Context|array|null $context - */ - private function initializeContextWithGlobalFallback($context): void + private function initializeContext(Context $context): void { - if ($context instanceof Context) { - $this->context = $context; - } else { - // Use the global context for now - trigger_error('TypoScriptFrontendController requires a context object as first constructor argument in TYPO3 v11.0, now falling back to the global Context. This fallback layer will be removed in TYPO3 v11.0', E_USER_DEPRECATED); - $this->context = GeneralUtility::makeInstance(Context::class); - } + $this->context = $context; if (!$this->context->hasAspect('frontend.preview')) { $this->context->setAspect('frontend.preview', GeneralUtility::makeInstance(PreviewAspect::class)); } } - /** - * Second argument of the constructor. Until TYPO3 v10, this was the Page ID (int/string) but since TYPO3 v10.0 - * this can also be a SiteInterface object, which will be mandatory in TYPO3 v11.0. If no Site object is given, - * this is fetched from the given request object. - * - * @param SiteInterface|int|string $siteOrId - * @param ServerRequestInterface $request - */ - private function initializeSiteWithCompatibility($siteOrId, ServerRequestInterface $request): void - { - if ($siteOrId instanceof SiteInterface) { - $this->site = $siteOrId; - } else { - trigger_error('TypoScriptFrontendController should evaluate the parameter "id" by the PageArguments object, not by a separate constructor argument. This functionality will be removed in TYPO3 v11.0', E_USER_DEPRECATED); - $this->id = $siteOrId; - if ($request->getAttribute('site') instanceof SiteInterface) { - $this->site = $request->getAttribute('site'); - } else { - throw new \InvalidArgumentException('TypoScriptFrontendController must be constructed with a valid Site object or a resolved site in the current request as fallback. None given.', 1561583122); - } - } - } - - /** - * Until TYPO3 v10.0, the third argument of the constructor was given from GET/POST "type" to define the page type - * Since TYPO3 v10.0, this argument is requested to be of type SiteLanguage, which will be mandatory in TYPO3 v11.0. - * If no SiteLanguage object is given, this is fetched from the given request object. - * - * @param SiteLanguage|int|string $siteLanguageOrType - * @param ServerRequestInterface $request - */ - private function initializeSiteLanguageWithCompatibility($siteLanguageOrType, ServerRequestInterface $request): void - { - if ($siteLanguageOrType instanceof SiteLanguage) { - $this->language = $siteLanguageOrType; - } else { - trigger_error('TypoScriptFrontendController should evaluate the parameter "type" by the PageArguments object, not by a separate constructor argument. This functionality will be removed in TYPO3 v11.0', E_USER_DEPRECATED); - $this->type = $siteLanguageOrType; - if ($request->getAttribute('language') instanceof SiteLanguage) { - $this->language = $request->getAttribute('language'); - } else { - throw new \InvalidArgumentException('TypoScriptFrontendController must be constructed with a valid SiteLanguage object or a resolved site in the current request as fallback. None given.', 1561583127); - } - } - } - - /** - * Since TYPO3 v10.0, the fourth constructor argument should be of type PageArguments. However, until TYPO3 v8, - * this was the GET/POST parameter "no_cache". If no PageArguments object is given, the given request is checked - * for the PageArguments. - * - * @param bool|string|PageArguments|null $pageArguments - * @param ServerRequestInterface $request - * @return PageArguments - */ - private function buildPageArgumentsWithFallback($pageArguments, ServerRequestInterface $request): PageArguments - { - if ($pageArguments instanceof PageArguments) { - return $pageArguments; - } - if ($request->getAttribute('routing') instanceof PageArguments) { - return $request->getAttribute('routing'); - } - trigger_error('TypoScriptFrontendController must be constructed with a valid PageArguments object or a resolved page argument in the current request as fallback. None given.', E_USER_DEPRECATED); - $queryParams = $request->getQueryParams(); - $pageId = $this->id ?: ($queryParams['id'] ?? $request->getParsedBody()['id'] ?? 0); - $pageType = $this->type ?: ($queryParams['type'] ?? $request->getParsedBody()['type'] ?? 0); - return new PageArguments((int)$pageId, (string)$pageType, [], $queryParams); - } - - /** - * Since TYPO3 v10.0, the fifth constructor argument is expected to to be of Type FrontendUserAuthentication. - * However, up until TYPO3 v9.5 this argument was used to define the "cHash" GET/POST parameter. In order to - * ensure maximum compatibility, a deprecation is triggered if an old argument is still used, and PageArguments - * are updated accordingly, and returned. - * - * @param string|FrontendUserAuthentication|null $cHashOrFrontendUser - * @param PageArguments $pageArguments - * @return PageArguments - */ - private function initializeFrontendUserOrUpdateCHashArgument($cHashOrFrontendUser, PageArguments $pageArguments): PageArguments - { - if ($cHashOrFrontendUser === null) { - return $pageArguments; - } - if ($cHashOrFrontendUser instanceof FrontendUserAuthentication) { - $this->fe_user = $cHashOrFrontendUser; - return $pageArguments; - } - trigger_error('TypoScriptFrontendController should evaluate the parameter "cHash" by the PageArguments object, not by a separate constructor argument. This functionality will be removed in TYPO3 v11.0', E_USER_DEPRECATED); - return new PageArguments( - $pageArguments->getPageId(), - $pageArguments->getPageType(), - $pageArguments->getRouteArguments(), - array_replace_recursive($pageArguments->getStaticArguments(), ['cHash' => $cHashOrFrontendUser]), - $pageArguments->getDynamicArguments() - ); - } - - /** - * Since TYPO3 v10.0 the seventh constructor argument is not needed anymore, as all data is already provided by - * the given PageArguments object. However, if a specific MP parameter is given anyways, the PageArguments object - * is updated and returned. - * - * @param string|null $MP - * @param PageArguments $pageArguments - * @return PageArguments - */ - private function initializeLegacyMountPointArgument(?string $MP, PageArguments $pageArguments): PageArguments - { - if ($MP === null) { - return $pageArguments; - } - trigger_error('TypoScriptFrontendController should evaluate the MountPoint Parameter "MP" by the PageArguments object, not by a separate constructor argument. This functionality will be removed in TYPO3 v11.0', E_USER_DEPRECATED); - if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) { - return $pageArguments; - } - return new PageArguments( - $pageArguments->getPageId(), - $pageArguments->getPageType(), - $pageArguments->getRouteArguments(), - array_replace_recursive($pageArguments->getStaticArguments(), ['MP' => $MP]), - $pageArguments->getDynamicArguments() - ); - } - /** * Initializes the page renderer object */ @@ -955,7 +798,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface $userGroups = array_merge($userGroups, array_map('intval', $groupsFromUserRecord)); } - $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, $userGroups)); + $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, $userGroups)); // For every 60 seconds the is_online timestamp for a logged-in user is updated if ($isUserAndGroupSet) { @@ -3883,7 +3726,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface */ public static function getGlobalInstance(): ?self { - if ($GLOBALS['TSFE'] instanceof self) { + if (($GLOBALS['TSFE'] ?? null) instanceof self) { return $GLOBALS['TSFE']; } diff --git a/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php b/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php index d8b379c6c982f0d7eeb702580bd29c3b9c013e4e..a1b00285ba79a5ca8a9a96098e2fc2448b0bb544 100644 --- a/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php +++ b/typo3/sysext/frontend/Classes/Middleware/TypoScriptFrontendInitialization.php @@ -30,6 +30,7 @@ use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Aspect\PreviewAspect; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\Controller\ErrorController; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons; @@ -79,13 +80,18 @@ class TypoScriptFrontendInitialization implements MiddlewareInterface } $this->context->setAspect('frontend.preview', GeneralUtility::makeInstance(PreviewAspect::class)); + $frontendUser = $request->getAttribute('frontend.user'); + if (!$frontendUser instanceof FrontendUserAuthentication) { + throw new \RuntimeException('The PSR-7 Request attribute "frontend.user" needs to be available as FrontendUserAuthentication object (as created by the FrontendUserAuthenticator middleware).', 1590740612); + } + $controller = GeneralUtility::makeInstance( TypoScriptFrontendController::class, $this->context, $site, $request->getAttribute('language', $site->getDefaultLanguage()), $pageArguments, - $request->getAttribute('frontend.user', null) + $frontendUser ); if ($pageArguments->getArguments()['no_cache'] ?? $request->getParsedBody()['no_cache'] ?? false) { $controller->set_no_cache('&no_cache=1 has been supplied, so caching is disabled! URL: "' . (string)$request->getUri() . '"'); diff --git a/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php b/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php index c17a5d7f62bbc3706ec38f7ab2e0d6f0b32e5e64..0f69694800042908254b86ad5e16fcfabd6ce17b 100644 --- a/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php +++ b/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php @@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Http\UrlProcessorInterface; @@ -271,7 +272,8 @@ abstract class AbstractTypolinkBuilder GeneralUtility::makeInstance(Context::class), $site, $language, - $request->getAttribute('routing', new PageArguments((int)$id, (string)$type, [])) + $request->getAttribute('routing', new PageArguments((int)$id, (string)$type, [])), + GeneralUtility::makeInstance(FrontendUserAuthentication::class) ); $this->typoScriptFrontendController->sys_page = GeneralUtility::makeInstance(PageRepository::class); $this->typoScriptFrontendController->tmpl = GeneralUtility::makeInstance(TemplateService::class); diff --git a/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php index 44cbb992da44337fa777fc4cd52eb3a366b8ee91..11f7326c82d665f99cec7275701c6aafe89c60b8 100644 --- a/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php @@ -495,7 +495,7 @@ class ConditionMatcherTest extends FunctionalTestCase */ protected function setupFrontendUserContext(array $groups = []): void { - $frontendUser = new FrontendUserAuthentication(); + $frontendUser = $GLOBALS['TSFE']->fe_user; $frontendUser->user['uid'] = 13; $frontendUser->groupData['uid'] = $groups; @@ -536,7 +536,8 @@ class ConditionMatcherTest extends FunctionalTestCase GeneralUtility::makeInstance(Context::class), $site, $site->getLanguageById(0), - new PageArguments($pageId, '0', []) + new PageArguments($pageId, '0', []), + new FrontendUserAuthentication() ); $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class); $GLOBALS['TSFE']->tmpl = GeneralUtility::makeInstance(TemplateService::class); diff --git a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php index 0b43e58ae4f7508d55dcbfa75f09cb471a584917..31dd4abccfda761b28347d659e43279591673150 100644 --- a/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Functional/ContentObject/ContentObjectRendererTest.php @@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Typolink\PageLinkBuilder; @@ -78,7 +79,8 @@ class ContentObjectRendererTest extends FunctionalTestCase GeneralUtility::makeInstance(Context::class), $site, $site->getDefaultLanguage(), - new PageArguments(1, '0', []) + new PageArguments(1, '0', []), + GeneralUtility::makeInstance(FrontendUserAuthentication::class) ); $this->typoScriptFrontendController->sys_page = GeneralUtility::makeInstance(PageRepository::class); $this->typoScriptFrontendController->tmpl = GeneralUtility::makeInstance(TemplateService::class); diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php index e5020f6b16619a925976ad755d92d0ce8264c07c..39aa054ba4244a69e8fdb1fe689821efa0ae3dbf 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php @@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Localization\LocalizationFactory; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; @@ -81,8 +82,9 @@ class AbstractMenuContentObjectTest extends UnitTestCase $languageServiceFactoryProphecy = $this->prophesize(LanguageServiceFactory::class); $languageServiceFactoryProphecy->create(Argument::any())->willReturn($languageService); GeneralUtility::addInstance(LanguageServiceFactory::class, $languageServiceFactoryProphecy->reveal()); + $frontendUserProphecy = $this->prophesize(FrontendUserAuthentication::class); $GLOBALS['TSFE'] = $this->getMockBuilder(TypoScriptFrontendController::class) - ->setConstructorArgs([new Context(), $site, $site->getDefaultLanguage(), new PageArguments(1, '1', [])]) + ->setConstructorArgs([new Context(), $site, $site->getDefaultLanguage(), new PageArguments(1, '1', []), $frontendUserProphecy->reveal()]) ->setMethods(['initCaches']) ->getMock(); $GLOBALS['TSFE']->cObj = new ContentObjectRenderer(); diff --git a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php index 851341bd3bb45cdeb720f43c01006cc707728a2b..482a370fef1d7754a3204013dd998cc968fd8ae5 100644 --- a/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php @@ -38,6 +38,7 @@ use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\StringUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -561,12 +562,14 @@ class TypoScriptFrontendControllerTest extends UnitTestCase return $languageService; }); GeneralUtility::addInstance(LanguageServiceFactory::class, $languageServiceFactoryProphecy->reveal()); + $frontendUserProphecy = $this->prophesize(FrontendUserAuthentication::class); // Constructor calling initPageRenderer() new TypoScriptFrontendController( new Context(), $site, $site->getLanguageById(0), - new PageArguments(13, '0', []) + new PageArguments(13, '0', []), + $frontendUserProphecy->reveal() ); // since PageRenderer is a singleton, this can be queried via the makeInstance call self::assertEquals('fr-test', GeneralUtility::makeInstance(PageRenderer::class)->getLanguage()); @@ -594,6 +597,7 @@ class TypoScriptFrontendControllerTest extends UnitTestCase return $languageService; }); GeneralUtility::addInstance(LanguageServiceFactory::class, $languageServiceFactoryProphecy->reveal()); + $frontendUserProphecy = $this->prophesize(FrontendUserAuthentication::class); // Constructor calling setOutputLanguage() $subject = $this->getAccessibleMock( TypoScriptFrontendController::class, @@ -602,7 +606,8 @@ class TypoScriptFrontendControllerTest extends UnitTestCase new Context(), $site, $site->getLanguageById(0), - new PageArguments(13, '0', []) + new PageArguments(13, '0', []), + $frontendUserProphecy->reveal() ] ); $languageService = $subject->_get('languageService'); diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstructorArgumentMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstructorArgumentMatcher.php index 42a444457e722e45c82deafcacda1f75b435af61..2266f499aeba0d350c10ebe981ca1468b13c6247 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstructorArgumentMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstructorArgumentMatcher.php @@ -13,16 +13,18 @@ return [ ], 'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController' => [ 'dropped' => [ - 'maximumNumberOfArguments' => 7, + 'maximumNumberOfArguments' => 5, 'restFiles' => [ 'Breaking-82572-RDCTFunctionalityRemoved.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst', ], ], 'unused' => [ - 'unusedArgumentNumbers' => [ 4 ], + 'unusedArgumentNumbers' => [ 6, 7 ], 'restFiles' => [ 'Deprecation-86002-TSFEConstructorWithNo_cacheArgument.rst', 'Breaking-87193-DeprecatedFunctionalityRemoved.rst', + 'Breaking-91473-DeprecatedFunctionalityRemoved.rst', ], ], ], diff --git a/typo3/sysext/redirects/Classes/Service/RedirectService.php b/typo3/sysext/redirects/Classes/Service/RedirectService.php index e86693d3a5a21ed99dccaf25f6fbfd278ebfc607..6805b42abd23600de8fa157cc274d4c512d5d4ad 100644 --- a/typo3/sysext/redirects/Classes/Service/RedirectService.php +++ b/typo3/sysext/redirects/Classes/Service/RedirectService.php @@ -330,9 +330,9 @@ class RedirectService implements LoggerAwareInterface GeneralUtility::makeInstance(Context::class), $site, $site->getDefaultLanguage(), - new PageArguments((int)$pageId, '0', []) + new PageArguments((int)$pageId, '0', []), + $frontendUserAuthentication ); - $controller->fe_user = $frontendUserAuthentication; $controller->fetch_the_id(); $controller->calculateLinkVars($queryParams); $controller->getConfigArray(); diff --git a/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php b/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php index cff84d9a41b6c4a8121621f2663a1c8832273ab3..1a7d1c2a82bd584c9a6a02f966d091f53287f401 100644 --- a/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php +++ b/typo3/sysext/seo/Tests/Functional/Canonical/CanonicalGeneratorTest.php @@ -24,6 +24,7 @@ use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\TypoScript\TemplateService; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\AbstractTestCase; @@ -61,7 +62,8 @@ class CanonicalGeneratorTest extends AbstractTestCase GeneralUtility::makeInstance(Context::class), $site, $site->getDefaultLanguage(), - new PageArguments($uid, '0', []) + new PageArguments($uid, '0', []), + GeneralUtility::makeInstance(FrontendUserAuthentication::class) ); $typoScriptFrontendController->cObj = new ContentObjectRenderer(); $typoScriptFrontendController->cObj->setLogger(new NullLogger());