Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Json data formatting when using customVariables #2102

Closed
anonymous-matomo-user opened this issue Feb 22, 2011 · 3 comments
Closed
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@anonymous-matomo-user
Copy link

The key/value pairs of the customVariables are sent in the following format to piwik.php and the PiWik_Tracker_Visit::getCustomVariables procedure:

{"1":"["key","value"]"}

json_decode parses this into:

Array
(
[=> "key","value"
)

But the correct result should be:

Array
(
[1] => Array
(
[0] => key
[1] => value
)

)

The corresponding JSON string after a json_encode of the correct array structure:

{"1":["key","value"]}

(Note the two missing " next to the brackets)

Using:

Firefox: 3.6.13
Php: 5.3.3

@robocoder
Copy link
Contributor

Are you using trunk, or one of the release candidates?

@robocoder
Copy link
Contributor

Closing this for now as I can't reproduce in trunk with ff 3.6.13 or ff 4 beta 10 (running php 5.3.5).

@christianfutterlieb
Copy link

I experienced the same problem. The reason was an installed mootools framework (version 1.2.4).

In js/piwik.js@line 115:

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

Mootools implements Array.toJSON() in this version. As of mootools 1.3 this problem is solved, see: [https://mootools.lighthouseapp.com/projects/2706/tickets/986-tojson-method-misused]

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 1.2 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants