Update 1.3 -> 1.4: "JSON Parse Error" -> "Division by zero" VerticalBar.php:65


(Marvin) #1

After upgrading from 1.3 to 1.4, the “Visitors by Server Time” widget in my dashboard shows:

Open Flash Chart

JSON Parse Error [Syntax Error]
Error at character 0, line 1:

Warning: Division by zero in …/piwik/core/Visualization/Chart/VerticalBar.php on line 65

Backtrace -->
#0 Piwik_ErrorHandler(2, Division by zero, …/piwik/core/Visualization/Chart/VerticalBar.php, 65, Array ([dataSetsToDisplay] => Array ([0] => nb_visits),[dataSetToDisplay] => nb_visits,[bar] => bar_filled Object ([type] => bar_filled,[colour] => #3B5AA9,[outline-colour] => #063E7E,[alpha] => 0.5,[text] => Besuche,[font-size] => 12,[tip] => #val# #key#),[yValues] => Array ([0] => 0,[1] => 0,[2] => 0,[3] => 0,[4] => 0,[5] => 0,[6] => 0,[7] => 0,[8] => 0,[9] => 0,[10] => 0,[11] => 0,[12] => 0,[13] => 0,[14] => 0),[labelName] => Besuche,[unit] => ,[barValues] => Array (),[i] => 0,[sum] => 0,[label] => 0h,[value] => 0,[displayPercentage] => )) called at […/piwik/core/Visualization/Chart/VerticalBar.php:65]#1 Piwik_Visualization_Chart_VerticalBar->customizeChartProperties() called at […/piwik/core/ViewDataTable/GenerateGraphData.php:127]#2 Piwik_ViewDataTable_GenerateGraphData->main() called at […/piwik/core/Controller.php:146]#3 Piwik_Controller->renderView(Piwik_ViewDataTable_GenerateGraphData_ChartVerticalBar Object ([] => 24,[] => ,[] => 1,[] => ,[] => 1,[] => Array ([hideFutureHoursWhenToday] => 1,[filter_sort_column] => label,[filter_sort_order] => asc,[filter_limit] => ,[disable_queued_filters] => 1),[] => Array ([show_goals] => ,[show_search] => ,[show_table] => 1,[show_table_all_columns] => 1,[show_all_views_icons] => 1,[show_export_as_image_icon] => ,[show_export_as_rss_feed] => 1,[show_exclude_low_population] => ,[show_offset_information] => ,[show_pagination_control] => ,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => VisitTime.getVisitInformationPerServerTime,[uniqueId] => VisitTimegetVisitInformationPerServerTime),[] => 0,[] => Piwik_DataTable Object ([] => Array ([0] => Piwik_DataTable_Row Object ([c] => Array ([0] => Array ([label] => 0h,[nb_visits] => 0),[1] => Array (),[3] => )),[1] => Piwik_DataTable_Row Object ([c] => Array ([0] => Array ([label] => 1h,[nb_vi…#4 Piwik_VisitTime_Controller->getVisitInformationPerServerTime() called at [(null):0]#5 call_user_func_array(Array ([0] => Piwik_VisitTime_Controller Object ([] => VisitTime,[] => 2011-04-30,[] => Piwik_Date Object ([] => 1304172851,[] => UTC),[] => 2,[] => Piwik_Site Object ([] => 2)),[1] => getVisitInformationPerServerTime), Array ()) called at […/piwik/core/FrontController.php:127]#6 Piwik_FrontController->dispatch(VisitTime, getVisitInformationPerServerTime, Array ()) called at […/piwik/core/FrontController.php:147]#7 Piwik_FrontController->fetchDispatch(VisitTime, getVisitInformationPerServerTime, Array ()) called at […/piwik/core/ViewDataTable/GenerateGraphHTML.php:150]#8 Piwik_ViewDataTable_GenerateGraphHTML->getFlashData() called at […/piwik/core/ViewDataTable/GenerateGraphHTML.php:116]#9 Piwik_ViewDataTable_GenerateGraphHTML->buildView() called at […/piwik/core/ViewDataTable/GenerateGraphHTML.php:90]#10 Piwik_ViewDataTable_GenerateGraphHTML->main() called at […/piwik/core/Controller.php:146]#11 Piwik_Controller->renderView(Piwik_ViewDataTable_GenerateGraphHTML_ChartVerticalBar Object ([] => 100%,[] => 250,[] => standard,[] => CoreHome/templates/graph.tpl,[] => 1,[] => Array ([hideFutureHoursWhenToday] => 1,[filter_sort_column] => label,[filter_sort_order] => asc,[filter_limit] => 24),[] => Array ([show_goals] => ,[show_search] => ,[show_table] => 1,[show_table_all_columns] => 1,[show_all_views_icons] => 1,[show_export_as_image_icon] => 1,[show_export_as_rss_feed] => 1,[show_exclude_low_population] => ,[show_offset_information] => ,[show_pagination_control] => ,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => VisitTime.getVisitInformationPerServerTime,[uniqueId] => VisitTimegetVisitInformationPerServerTime),[] => 0,[] => ,[] => Array (),[] => Array (),[] => getVisitInformationPerServerTime,[] => VisitTime,[] => ,[] => VisitTime.getVisitInformationPerServerTime,[] => ,[] => Array ([nb_visits] => Besuche,[nb_uniq_visitors] => Eindeutige Besucher,[…#12 Piwik_VisitTime_Controller->getVisitInformationPerServerTime() called at [(null):0]#13 call_user_func_array(Array ([0] => Piwik_VisitTime_Controller Object ([] => VisitTime,[] => 2011-04-30,[] => Piwik_Date Object ([] => 1304172851,[] => UTC),[] => 2,[] => Piwik_Site Object ([] => 2)),[1] => getVisitInformationPerServerTime), Array ()) called at […/piwik/core/FrontController.php:127]#14 Piwik_FrontController->dispatch() called at […/piwik/index.php:58]

Doesn’t look so good…


(Matthieu Aubry) #2

Thanks for the report. The bug only occurs when date is today, and where there is no visit. It is fixed in SVN: Error in report "visits by server time" when there is no visit · Issue #2381 · matomo-org/matomo · GitHub


#3

I have the same problem. Here is my backtrace in the apache log

Bug: Division by zero in /usr/share/piwik/core/Visualization/Chart/VerticalBar.php on line 65

Backtrace:

#0 Piwik_ErrorHandler(2, Division by zero, /usr/share/piwik/core/Visualization/Chart/VerticalBar.php, 65, Array ([dataSetsToDisplay] => Array ([0] => nb_visits),[dataSetToDisplay] => nb_visits,[bar] => bar_filled Object ([type] => bar_filled,[colour] => #3B5AA9,[outline-colour] => #063E7E,[alpha] => 0.5,[text] => Besuche,[font-size] => 12,[tip] => #val# #key#),[yValues] => Array ([0] => 0,[1] => 0,[2] => 0,[3] => 0,[4] => 0,[5] => 0,[6] => 0,[7] => 0,[8] => 0,[9] => 0,[10] => 0,[11] => 0,[12] => 0,[13] => 0),[labelName] => Besuche,[unit] => ,[barValues] => Array ([0] => bar_value Object ([top] => 0,[tip] => 0h
0 Besuche (0%)),[1] => bar_value Object ([top] => 0,[tip] => 1h
0 Besuche (0%)),[2] => bar_value Object ([top] => 0,[tip] => 2h
0 Besuche (0%)),[3] => bar_value Object ([top] => 0,[tip] => 3h
0 Besuche (0%)),[4] => bar_value Object ([top] => 0,[tip] => 4h
0 Besuche (0%)),[5] => bar_value Object ([top] => 0,[tip] => 5h
0#1 Piwik_Visualization_Chart_VerticalBar->customizeChartProperties() called at [/usr/share/piwik/core/ViewDataTable/GenerateGraphData.php:127]#2 Piwik_ViewDataTable_GenerateGraphData->main() called at [/usr/share/piwik/core/Controller.php:146]#3 Piwik_Controller->renderView(Piwik_ViewDataTable_GenerateGraphData_ChartVerticalBar Object ([] => 24,[] => ,[] => 1,[] => ,[] => 1,[] => Array ([hideFutureHoursWhenToday] => 1,[filter_sort_column] => label,[filter_sort_order] => asc,[filter_limit] => ,[disable_queued_filters] => 1),[] => Array ([show_goals] => 1,[show_search] => ,[show_table] => 1,[show_table_all_columns] => 1,[show_all_views_icons] => 1,[show_export_as_image_icon] => ,[show_export_as_rss_feed] => 1,[show_exclude_low_population] => ,[show_offset_information] => ,[show_pagination_control] => ,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => VisitTime.getVisitInformationPerServerTime,[uniqueId] => VisitTimegetVisitInformationPerServerTime),[] => 0,[] => Piwik_DataTable Object ([] => Array ([0] => Piwik_DataTable_Row Object ([c] => Array ([0] => Array ([label] => 0h,[nb_visits] => 0),[1] => Array (),[3] => )),[1] => Piwik_DataTable_Row Object ([c] => Array ([0] => Array ([label] => 1h,[nb_v…#4 Piwik_VisitTime_Controller->getVisitInformationPerServerTime()#5 call_user_func_array(Array ([0] => Piwik_VisitTime_Controller Object ([] => VisitTime,[] => 2011-05-01,[] => Piwik_Date Object ([] => 1304255084,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getVisitInformationPerServerTime), Array ()) called at [/usr/share/piwik/core/FrontController.php:127]#6 Piwik_FrontController->dispatch(VisitTime, getVisitInformationPerServerTime, Array ()) called at [/usr/share/piwik/core/FrontController.php:147]#7 Piwik_FrontController->fetchDispatch(VisitTime, getVisitInformationPerServerTime, Array ()) called at [/usr/share/piwik/core/ViewDataTable/GenerateGraphHTML.php:150]#8 Piwik_ViewDataTable_GenerateGraphHTML->getFlashData() called at [/usr/share/piwik/core/ViewDataTable/GenerateGraphHTML.php:116]#9 Piwik_ViewDataTable_GenerateGraphHTML->buildView() called at [/usr/share/piwik/core/ViewDataTable/GenerateGraphHTML.php:90]#10 Piwik_ViewDataTable_GenerateGraphHTML->main() called at [/usr/share/piwik/core/Controller.php:146]#11 Piwik_Controller->renderView(Piwik_ViewDataTable_GenerateGraphHTML_ChartVerticalBar Object ([] => 100%,[] => 250,[] => standard,[] => CoreHome/templates/graph.tpl,[] => 1,[] => Array ([hideFutureHoursWhenToday] => 1,[filter_sort_column] => label,[filter_sort_order] => asc,[filter_limit] => 24),[] => Array ([show_goals] => 1,[show_search] => ,[show_table] => 1,[show_table_all_columns] => 1,[show_all_views_icons] => 1,[show_export_as_image_icon] => 1,[show_export_as_rss_feed] => 1,[show_exclude_low_population] => ,[show_offset_information] => ,[show_pagination_control] => ,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => VisitTime.getVisitInformationPerServerTime,[uniqueId] => VisitTimegetVisitInformationPerServerTime),[] => 0,[] => ,[] => Array (),[] => Array (),[] => getVisitInformationPerServerTime,[] => VisitTime,[] => ,[] => VisitTime.getVisitInformationPerServerTime,[] => ,[] => Array ([nb_visits] => Besuche,[nb_uniq_visitors] => Eindeutige Besucher,…#12 Piwik_VisitTime_Controller->getVisitInformationPerServerTime()#13 call_user_func_array(Array ([0] => Piwik_VisitTime_Controller Object ([] => VisitTime,[] => 2011-05-01,[] => Piwik_Date Object ([] => 1304255084,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getVisitInformationPerServerTime), Array ()) called at [/usr/share/piwik/core/FrontController.php:127]#14 Piwik_FrontController->dispatch() called at [/usr/share/piwik/index.php:58]


(vipsoft) #4

ripper: the same fix can be applied in your case