@mattab opened this issue on February 16th 2014

This was reported in the forums

Notice: Undefined offset: 4 in /var/www/html/webstats.sapphirewebservices.com/core/DataArray.php on line 109

The bug appeared for two users when they changed "visit" scope custom variables to "page" scope custom variables.

Instead, this should work as expected and not write out an error message.

@mattab commented on February 17th 2014

In 07305105e4c5050412be11f914d58d0e840e9912: Fixes #4687 Initializes the row values so this works without errors even in this edge case. I couldn't easily reproduce this error in a test, so just fixing the bug as is.

@anonymous-piwik-user commented on February 20th 2014

mattab: Sorry, I dont have a working dev env (yet) - Can you pl. accept my below patch as a one-off. Thanks.

I had the same issue, but the patch applied did not work. I had to move it a few lines up, and add some more enums to the list to work:

Basically remove the existing patch, and apply the below code to line no 102 of core/DataArray.php -------------8<-----------------------------------------8<--------------------- // In case the existing Row had no action metrics (eg. Custom Variable XYZ with "visit" scope) // but the new Row has action metrics (eg. same Custom Variable XYZ this time with a "page" scope) if(!isset($oldRowToUpdate[Metrics::INDEX_MAX_ACTIONS])) { $toZero = array(Metrics::INDEX_NB_VISITS, Metrics::INDEX_NB_ACTIONS, Metrics::INDEX_NB_UNIQ_VISITORS, Metrics::INDEX_MAX_ACTIONS, Metrics::INDEX_SUM_VISIT_LENGTH, Metrics::INDEX_BOUNCE_COUNT, Metrics::INDEX_NB_VISITS_CONVERTED); foreach($toZero as $metric) { $oldRowToUpdate[$metric] = 0; } } -------------8<-----------------------------------------8<---------------------

@mattab commented on February 23rd 2014

can you please follow instructions at: http://forum.piwik.org/read.php?2,109735,page=1#msg-109779

and then post the message you are getting after making the patch from this forum post? Thanks!

@anonymous-piwik-user commented on February 25th 2014

matt: Strange thing - am unable to reproduce the bug - Even without the patch! Is there some kind of indexing that might be at work?

I even tried adding more data, just in case it was caching at work - but I see the new goals taking place, but not able to reproduce the error!

What gives?

@mattab commented on February 27th 2014

to reproduce you would have to re-process the data: How do I force the reports to be re-processed from the logs?

please reopen the ticket, with full error message (using latest 2.1RC), if you can reproduce. cheers

This issue was closed on February 27th 2014
Powered by GitHub Issue Mirror