[!!!][TASK] Remove config.defaultGetVars 99/60799/4
authorBenni Mack <benni@typo3.org>
Wed, 22 May 2019 19:24:16 +0000 (21:24 +0200)
committerSusanne Moog <look@susi.dev>
Fri, 24 May 2019 10:38:41 +0000 (12:38 +0200)
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>
typo3/sysext/core/Classes/Routing/PageArguments.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TypoScript/setup.typoscript
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php
typo3/sysext/t3editor/Resources/Private/tsref.xml

index 3cda26b..5c76d35 100644 (file)
@@ -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
      */
index 495ba81..8b45ffa 100644 (file)
@@ -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`
index 5ce83c7..73509fc 100644 (file)
@@ -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]
index dd3a515..16a4871 100644 (file)
@@ -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';
index fb0b0a7..2e754e6 100644 (file)
@@ -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();
index 5d4b0b8..b68a5f8 100644 (file)
@@ -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">