Bug in AbstractUri::buildQuery - invalid HTML emitted ('[' and ']' not encoded in tagged elements list) #21
Bug in AbstractUri::buildQuery - invalid HTML emitted ('[' and ']' not encoded in tagged elements list) #21zero-24 wants to merge 3 commits intojoomla-framework:masterfrom zero-24:patch-1
Conversation
|
Please, followe the steps provided in issue: Bug in AbstractUri::buildQuery - invalid HTML emitted ('[' and ']' not encoded in tagged elements list) #17365 (joomla/joomla-cms#17365 ). So you can test the invalid html emitted. |
Good question. In a sad bit of irony, that method has zero test coverage so we don't even have a valid assertion on what it should be doing right now and what this changes. So even if the issue and fix are both valid (I'm not saying they aren't, it's just difficult to follow at first glance), we really need to find the code that's feeding data into the Uri class chain, extract that data, and turn it into a test case. |
|
The problem is visible when URL SEF is not active as we get queries liek that: |
|
I'm shooting blind here but hopefully a2b635c gives us a code test case to validate the behavior. |
1) Joomla\Uri\Tests\UriTest::testBuildQueryEncoding
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'option=com_tags&view=tag&id[0]=3&types[0]=2&Itemid=110'
+'option=com_tags&view=tag&id%5B0%5D=3&types%5B0%5D=2&Itemid=110'So is the intended end state that Looking at this result, I'm inclined to lean toward the current behavior being the preferred behavior as encoding is something you need to handle at the presentation layer (anything spitting out HTML), I'm not so sure the library should default to returning encoded query strings. Either way I need to think about this when I'm not quickly glancing in the middle of my lunch break at things. |
|
Yes, my intended end state was that buildQuery returned an encoded URL. |
|
To me, I see two issues with this fix:
If we had an |
|
In the whole Joomla codebase AbstractUri::buildQuery is called 3 times in 3 files (Joomla! 3.7.4):
|
|
I do have to say, scanning for direct uses of With that said though, more frequently the |
|
Ok, so we have to find a different solution. Where do you suggest I can start for a new solution? |
|
So if I'm not mistaken, the main culprit here is if you configure a tag menu item (and only that with "normal" CMS use, I'm not finding any other code path that could generate such a URL with com_tags specifically). The only place we really "control" menu item rendering is Closing this PR, feel free to keep posting here if needed though. |
|
I've looked where you suggested.
I've been using solution 2) for 2 years now in some production sites that use various extensions without any problem, so in practice to me it has not been a B/C. Any ideas? |
|
Opened a related New Issue and proposed a solution with narrower impact: Issue #17966 |
Pull Request for Issue joomla/joomla-cms#17365
Summary of Changes
Remove the urldecode
Testing Instructions
@LivioCavallo please provide some test instructions
Documentation Changes Required
B/C break?