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