[BUGFIX] Ensure correct URL generation with http_build_query() 66/52966/2
authorMarkus Klein <markus.klein@typo3.org>
Wed, 24 May 2017 12:09:42 +0000 (14:09 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 29 May 2017 21:11:09 +0000 (23:11 +0200)
http_build_query() internally uses the PHP setting arg-separator.output
to identify the URL parameter separator.
This does not seem appropriate for URLs generated by TYPO3.

Use the optional parameters of http_build_query() to get the desired
functionality.

Releases: master, 8.7, 7.6
Resolves: #81366
Change-Id: Ie2df9207b1967257d6327ff1103503e6a58d5cdf
Reviewed-on: https://review.typo3.org/52966
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 6fa99b5..5e2e4f3 100644 (file)
@@ -345,7 +345,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
                 $module = $returnUrlParameters['M'];
                 $returnUrl = BackendUtility::getModuleUrl($module, $returnUrlParameters);
                 $parameters['returnUrl'] = $returnUrl;
-                $url = $parsedUrl['path'] . '?' . http_build_query($parameters);
+                $url = $parsedUrl['path'] . '?' . http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
             }
         }
 
index d5b0b7b..0df40dd 100644 (file)
@@ -1300,7 +1300,7 @@ class ResourceStorage implements ResourceStorageInterface
                     }
 
                     $queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'resourceStorageDumpFile');
-                    $publicUrl = 'index.php?' . str_replace('+', '%20', http_build_query($queryParameterArray));
+                    $publicUrl = 'index.php?' . http_build_query($queryParameterArray, '', '&', PHP_QUERY_RFC3986);
                 }
 
                 // If requested, make the path relative to the current script in order to make it possible