Project

General

Profile

Actions

Task #101625

closed

Simplify GeneralUtility::implodeArrayForUrl

Added by Oliver Klee 12 months ago. Updated 11 days ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Code Cleanup
Target version:
-
Start date:
2023-08-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

From https://review.typo3.org/c/Packages/TYPO3.CMS/+/80247/4#message-6b4a6d09948689295f9467fbb69c930995cd8549:

I wonder if that method cannot be simplified (in another patch, of course) that uses http_build_query() instead of manual array assembling.

Actions #1

Updated by Oliver Klee 12 months ago

  • Subject changed from Simplify GneralUtility::implodeArrayForUrl to Simplify GeneralUtility::implodeArrayForUrl
Actions #2

Updated by Stefan Bürk 12 months ago

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).

Actions #3

Updated by Benni Mack about 1 month ago

  • Status changed from New to Needs Feedback

There 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´ ?

Actions #4

Updated by Garvin Hicking about 1 month ago

@Benni Mack 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
crawler

Also 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.

Actions #5

Updated by Benni Mack about 1 month ago

Hey Garvin,

I would then suggest to just document the native alternative in the methods' comments.

Actions #6

Updated by Georg Ringer 11 days ago

  • Status changed from Needs Feedback to Rejected

hey 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

Actions #7

Updated by Oliver Klee 11 days ago

Makes sense. Thanks for checking and for cleaning up the issues, Georg!

Actions

Also available in: Atom PDF