[BUGFIX] Make encoding of parameters for cHash independent of PHP settings 22/52922/2
authorMarkus Klein <markus.klein@typo3.org>
Tue, 23 May 2017 20:51:35 +0000 (22:51 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 24 May 2017 04:43:33 +0000 (06:43 +0200)
http_build_query() internally uses the PHP setting arg-separator.output
to identify the URL parameter separator.
Our code relies on having a simple ampersand as this character.
If the PHP is set to a different configuration the code will fail.

This is fixed by enforcing the ampersand. Moreover we force RFC3986
encoding to ensure that decoding with rawurldecode() does the right
thing.

Releases: master, 8.7
Resolves: #81293
Change-Id: I321c7bba03ee597adc29a2f8429b8fc9ac3b709d
Reviewed-on: https://review.typo3.org/52922
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Carsten Falkenberg <office@limebox.de>
Tested-by: Carsten Falkenberg <office@limebox.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php

index dba0a5d..52743e3 100644 (file)
@@ -63,7 +63,7 @@ class CacheHashEnforcer implements SingletonInterface
             $parameters = [$pluginNamespace => $arguments];
             $parameters['id'] = $this->typoScriptFrontendController->id;
             $relevantParameters = $this->cacheHashCalculator->getRelevantParameters(
-                http_build_query($parameters)
+                http_build_query($parameters, '', '&', PHP_QUERY_RFC3986)
             );
             if (count($relevantParameters) > 0) {
                 $this->typoScriptFrontendController->reqCHash();