From df1bdb52edb2e1f43bc74e1d3cd7b5b9cde4b460 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Wed, 22 May 2019 21:24:16 +0200 Subject: [PATCH] [!!!][TASK] Remove config.defaultGetVars The TypoScript option config.defaultGetVars is not evaluated anymore, as this conflicts with TypoScript logic itself: After TypoScript parsing and condition evaluation in a Frontend Request, config.defaultGetVars is set, this would effectively mean that TypoScript parsing should be re-done in order to meet new possible matches in Conditions. As this logic is flawed and should now easily be handled via a custom middleware (previously this was helpful for setting e.g. L=0 for default pages with RealURL), it is now removed from Core. Resolves: #88419 Releases: master Change-Id: Ic286c96f71953062d7649d71abb72f8f0f20f1a9 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60799 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Susanne Moog <look@susi.dev> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Susanne Moog <look@susi.dev> --- .../core/Classes/Routing/PageArguments.php | 25 ------------------- ...g-87193-DeprecatedFunctionalityRemoved.rst | 5 ++-- .../Configuration/TypoScript/setup.typoscript | 4 --- .../TypoScriptFrontendController.php | 8 ------ .../PrepareTypoScriptFrontendRendering.php | 19 -------------- .../t3editor/Resources/Private/tsref.xml | 15 ----------- 6 files changed, 3 insertions(+), 73 deletions(-) diff --git a/typo3/sysext/core/Classes/Routing/PageArguments.php b/typo3/sysext/core/Classes/Routing/PageArguments.php index 3cda26b70f10..5c76d351b76a 100644 --- a/typo3/sysext/core/Classes/Routing/PageArguments.php +++ b/typo3/sysext/core/Classes/Routing/PageArguments.php @@ -156,31 +156,6 @@ class PageArguments implements RouteResultInterface return $this->queryArguments; } - /** - * @param array $queryArguments - * @return static - * @internal this is internal due to the issue that a PageArgument should not be modified, but must be within TYPO3 Core currently. - */ - public function withQueryArguments(array $queryArguments): self - { - $queryArguments = $this->sort($queryArguments); - if ($this->queryArguments === $queryArguments) { - return $this; - } - // in case query arguments would override route arguments, - // the state is considered as dirty (since it's not distinct) - // thus, route arguments take precedence over query arguments - $additionalQueryArguments = $this->diff($queryArguments, $this->routeArguments); - $dirty = $additionalQueryArguments !== $queryArguments; - // apply changes - $target = clone $this; - $target->dirty = $this->dirty || $dirty; - $target->queryArguments = $queryArguments; - $target->arguments = array_replace_recursive($target->arguments, $additionalQueryArguments); - $target->updateDynamicArguments(); - return $target; - } - /** * @param array $queryArguments */ diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst index 495ba81aadf4..8b45ffab9d02 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst @@ -1244,7 +1244,7 @@ The following user TSconfig options have been dropped: The following TypoScript options have been dropped: * `config.concatenateJsAndCss` -* `config.typolinkEnableLinksAcrossDomains` +* `config.defaultGetVars` * `config.language` * `config.locale_all` * `config.sys_language_isocode` @@ -1253,8 +1253,9 @@ The following TypoScript options have been dropped: * `config.sys_language_overlay` * `config.sys_language_uid` * `config.titleTagFunction` -* `config.typolinkCheckRootline` * `config.tx_extbase.objects` +* `config.typolinkCheckRootline` +* `config.typolinkEnableLinksAcrossDomains` * `config.USERNAME_substToken` * `config.USERUID_substToken` * `FILE` diff --git a/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TypoScript/setup.typoscript b/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TypoScript/setup.typoscript index 5ce83c7f07d2..73509fc00c8a 100644 --- a/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TypoScript/setup.typoscript +++ b/typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TypoScript/setup.typoscript @@ -58,9 +58,6 @@ tx_blogexample_plaintext { disableAllHeaderCode = 1 additionalHeaders.10.header = Content-Type: text/plain additionalHeaders.10.replace = 1 - defaultGetVars { - tx_blogexample_postlist.format = txt - } } } @@ -68,6 +65,5 @@ tx_blogexample_plaintext { [globalVar = TYPO3_CONF_VARS|EXTCONF|blog_example|registerSinglePlugin > 0] tx_blogexample_plaintext { 10.pluginName = Pi1 - #config.defaultGetVars = } [end] diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index dd3a51522310..16a48716e2aa 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -1904,14 +1904,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface if ($this->config['config']['no_cache']) { $this->set_no_cache('config.no_cache is set'); } - // Merge GET with defaultGetVars - // Please note that this code will get removed in TYPO3 v10.0 as it is done in the PSR-15 middleware. - if (!empty($this->config['config']['defaultGetVars.'])) { - $modifiedGetVars = GeneralUtility::removeDotsFromTS($this->config['config']['defaultGetVars.']); - ArrayUtility::mergeRecursiveWithOverrule($modifiedGetVars, GeneralUtility::_GET()); - $_GET = $modifiedGetVars; - $GLOBALS['HTTP_GET_VARS'] = $modifiedGetVars; - } // Auto-configure settings when a site is configured $this->config['config']['absRefPrefix'] = $this->config['config']['absRefPrefix'] ?? 'auto'; diff --git a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php index fb0b0a71f6d0..2e754e618278 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php +++ b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php @@ -20,9 +20,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface as PsrRequestHandlerInterface; -use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\TimeTracker\TimeTracker; -use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; @@ -72,23 +70,6 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface // After this, we should have a valid config-array ready $this->controller->getConfigArray(); - // Merge Query Parameters with config.defaultGetVars - // This is done in getConfigArray as well, but does not override the current middleware request object - // Since we want to stay in sync with this, the option needs to be set as well. - $pageArguments = $request->getAttribute('routing'); - if (!empty($this->controller->config['config']['defaultGetVars.'] ?? null)) { - $modifiedGetVars = GeneralUtility::removeDotsFromTS($this->controller->config['config']['defaultGetVars.']); - if ($pageArguments instanceof PageArguments) { - $pageArguments = $pageArguments->withQueryArguments($modifiedGetVars); - $this->controller->setPageArguments($pageArguments); - $request = $request->withAttribute('routing', $pageArguments); - } - if (!empty($request->getQueryParams())) { - ArrayUtility::mergeRecursiveWithOverrule($modifiedGetVars, $request->getQueryParams()); - } - $request = $request->withQueryParams($modifiedGetVars); - } - // Setting language and locale $this->timeTracker->push('Setting language and locale'); $this->controller->settingLanguage(); diff --git a/typo3/sysext/t3editor/Resources/Private/tsref.xml b/typo3/sysext/t3editor/Resources/Private/tsref.xml index 5d4b0b820fe2..b68a5f860bd8 100644 --- a/typo3/sysext/t3editor/Resources/Private/tsref.xml +++ b/typo3/sysext/t3editor/Resources/Private/tsref.xml @@ -292,21 +292,6 @@ This value is overridden by the value set in the page-record (field="cache_timeo <property name="debug" type="boolean"> <description><![CDATA[If set any debug-information in the TypoScript code is output. Currently this applies only to the menu-objects]]></description> <default><![CDATA[ -]]></default> - </property> - <property name="defaultGetVars" type="array"> - <description><![CDATA[Allows to set default values for GET parameters. Default value is taken only if the GET parameter isn't defined. Array notation is done with dots, e.g.: - -test[var1] will be written as text.var1 - -Example: - -config.defaultgetVars { - test.var1.var2.p3 = 15 - L = 3 -} - ]]></description> - <default><![CDATA[ ]]></default> </property> <property name="disableAllHeaderCode" type="boolean"> -- GitLab