#101625Simplify GeneralUtility::implodeArrayForUrl
Description
I wonder if that method cannot be simplified (in another patch, of course) that uses http_build_query() instead of manual array assembling.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 7
-
Oliver Klee changed subject
Simplify GneralUtility::implodeArrayForUrlSimplify GeneralUtility::implodeArrayForUrl 08/09/23, 07:40 -
Stefan Bürk commented 08/15/23, 13:44
-
Benni Mack commented and changed status
NewNeeds Feedback 06/19/24, 21:05There is only one place left, we can deprecate this method? Or we keep it? I don’t know if we have a problem keeping this method? Maybe documenting the difference between this method and `http_build_query´ ?
-
Garvin Hicking commented 06/25/24, 14:43
@benni That method is also used by a few public extensions:
sr_feuser_register
yoast_seo
tt_address
cs_seo
nnhelpers
pw_comments
maps2
recaptcha
mediaoembed
jar_utilities
jumpurl
tt_products
in2publish_core
rn_base
div2007
crawlerAlso undecided on whether it should be kept. As far as I can see most usages could be replaced in the extensions, so maybe we should encourage that by deprecating this method.
-
Benni Mack commented 06/26/24, 10:44
Hey Garvin,
I would then suggest to just document the native alternative in the methods’ comments.
-
Georg Ringer commented and changed status
Needs FeedbackRejected 07/16/24, 14:35hey Oliver,
this is not that easy as it seems.
When changing the method’s body to
return http_build_query($theArray, $name);
the tests will fail hard
--- Expected +++ Actual @@ @@ -'&foo[one]=%E2%88%9A&foo[two]=2' +'one=%E2%88%9A&two=2'
therefore I suggest leaving the method for the time being until we really don’t need it anymore and get rid of it.
as the benefit is so small compared to troubles we can produce for people I am closing this issue.
In an ideal world we could just migrate GU to something nicer but just for moving code around it is not worth the troubles -
Oliver Klee commented 07/16/24, 14:37
Makes sense. Thanks for checking and for cleaning up the issues, Georg!
Small note/hint:
The current implementation ensures a rawurlencode on values in a recursive manner.
This needs to be carefully checked if replaced with `http_build_query()`.
Maybe it makes sense to add special tests for this, if not already contained. (Not checked).