maze
(maze)
June 26, 2009, 10:44am
1
I get the following error message when im loading Visitors > Overview > Report > Actions but ONLY in the weeks view !
Open Flash Chart
JSON Parse Error [Bad Object]
Error at character 10209, line 255:
252: "grid-colour": "#E0E1E4",253: "min": 0,254: "max": 2.0e+5,
vipsoft
(vipsoft)
June 26, 2009, 1:10pm
2
This is a bug in Open Flash Charts 2 because “2.0e+5” is a valid numeric format in JSON. I’ve reported it upstream…
At the moment, I don’t have a workaround. AFAIK, Piwik and the OFC library aren’t converting it to e-notation, so this might be occurring in a php built-in function, e.g., json_encode().
vipsoft
(vipsoft)
June 27, 2009, 9:28pm
3
I wonder if somewhere the int is being converted to float because there’s some oddness in PHP when it comes to floats. Try the code from: http://www.php.net/manual/en/language.types.float.php#83577
Do you get 200000 or 2.0e+5?
vipsoft
(vipsoft)
June 27, 2009, 9:48pm
4
In core/Visualization/Chart.php, in the getMaxValue() function, try changing:
Index: Chart.php
===================================================================
--- Chart.php (revision 1258)
+++ Chart.php (working copy)
@@ -107,7 +107,7 @@
{
$maxCrossDataSets = $maxCrossDataSets + 10 - $maxCrossDataSets % 10;
}
- return $maxCrossDataSets;
+ return (int) $maxCrossDataSets;
}
public function setTitle($text, $css)
Please also state what version of PHP and operating system you’re using.
maze
(maze)
June 29, 2009, 6:23am
5
I tried the code from: http://www.php.net/manual/en/language.types.float.php#83577 and got int 200000
OS: openSUSE 10.2 (2.6.18.2-34-xen)
PHP 5.2.0
With the change in the Chart.php I get the error message in another line:
Open Flash Chart
JSON Parse Error [Bad Object]
Error at character 10231, line 256:
253: "min": 0,254: "max": 200000,255: "steps": 1.0e+5,
vipsoft
(vipsoft)
June 29, 2009, 4:37pm
6
Ok. Make this additional change to Chart.php:
@@ -161,7 +161,7 @@
$this->y->set_colour('#ffffff');
$this->y->set_grid_colour($gridColour);
$stepsCount = 2;
- $stepsEveryNLabel = ceil(($this->maxValue - $this->minValue) / $stepsCount);
+ $stepsEveryNLabel = (int) ceil(($this->maxValue - $this->minValue) / $stepsCount);
if($this->maxValue == 0)
{
$this->maxValue = 1;
Let us know if this works for you, so I can commit it to svn.
maze
(maze)
June 30, 2009, 5:12am
7
Yes, that works! style_emoticons/<#EMO_DIR#>/smile.gif Thank you.
vipsoft
(vipsoft)
June 30, 2009, 6:12am
8
Thanks.
In hindsight, I’ll be changing the patch, moving the casts to where we call setRange()/set_range() [?] but the desired effect should be the same.
death
(death)
July 3, 2009, 11:36am
9
i’m experiencing the same kind of error but the patches don’t seem to fix it:
Open Flash Chart
JSON Parse Error [Bad Object]
Error at character 182, line 9:
6: "type": "hollow-dot",7: "value": 0,8: "tip": "Thu 4 Jun<br>0 Conversions (goal \\"test\\")",
vipsoft
(vipsoft)
July 3, 2009, 2:39pm
10
That’s because it’s a different problem. Are you running 0.4.1?
death
(death)
July 3, 2009, 3:29pm
11
yep, piwik 0.4.1
centos 5, php 5.1.6
vipsoft
(vipsoft)
July 4, 2009, 11:01am
12
Here’s the fix to libs/upgradephp/upgrade.php:
Index: upgrade.php
===================================================================
--- upgrade.php (revision 1270)
+++ upgrade.php (working copy)
@@ -140,7 +140,7 @@
if (!utf8_decode($var)) {
$var = utf8_encode($var);
}
- $var = str_replace(array("\"", "\\", "/", "\b", "\f", "\n", "\r", "\t"), array("\\\"", "\\\\", "\\/", "\\b", "\\f", "\\n", "\\r", "\\t"), $var);
+ $var = str_replace(array("\\", "\"", "/", "\b", "\f", "\n", "\r", "\t"), array("\\\\", "\\\"", "\\/", "\\b", "\\f", "\\n", "\\r", "\\t"), $var);
$json = '"' . $var . '"';
//@COMPAT: for fully-fully-compliance $var = preg_replace("/[\000-\037]/", "", $var);
}
death
(death)
July 6, 2009, 11:43am
13
style_emoticons/<#EMO_DIR#>/smile.gif
that did the trick,
thx!