[BUGFIX] Ensure correct URL generation with http_build_query() 64/52964/2
authorMarkus Klein <markus.klein@typo3.org>
Wed, 24 May 2017 12:09:42 +0000 (14:09 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Mon, 29 May 2017 17:55:46 +0000 (19:55 +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/52964
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/core/Classes/LinkHandling/PageLinkHandler.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 652334a..ce3837b 100644 (file)
@@ -324,7 +324,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 3c0177c..a7ee98d 100644 (file)
@@ -77,7 +77,7 @@ class PageLinkHandler implements LinkHandlingInterface
             unset($data['type']);
         }
         if (!empty($data)) {
-            $result['parameters'] = http_build_query($data);
+            $result['parameters'] = http_build_query($data, '', '&', PHP_QUERY_RFC3986);
         }
         if (empty($result)) {
             $result['pageuid'] = 'current';
index a4575fc..8a1be9f 100644 (file)
@@ -1294,7 +1294,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