@anonymous-matomo-user opened this Issue on February 22nd 2011

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 commented on February 22nd 2011 Contributor

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

@robocoder commented on February 23rd 2011 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 commented on March 3rd 2011

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]

This Issue was closed on March 3rd 2011
Powered by GitHub Issue Mirror