Convert multidimensional query parameter args in URLs correctly #211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PHP supports sending/parsing multidimensional arrays in the URL, eg:
param[key1][key2][] = 12
which would be parsed as:
Python does not, so if you're replaying logs for a plugin that uses multidimensional array tracker query parameters, the replay will fail.
This fixes the issue by converting such parameters manually. Tried also to convert the parsed query string back into a query string (which would have been far simpler), but python 2 has trouble with converting querystrings with unicode.
Note: I tried converting the string parts to unicode before calling
urllib.urlencode()
(as suggested here: https://stackoverflow.com/questions/6480723/urllib-urlencode-doesnt-like-unicode-values-how-about-this-workaround), but that results in odd test failures in ImportLogsTest.php. This change doesn't.Core build for this PR is here: https://travis-ci.org/matomo-org/matomo/builds/372841147