View site statistics has error if there are no blocks

Bug #1799852 reported by Rebecca Blundell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Medium
Rebecca Blundell
17.10
New
Undecided
Unassigned
18.04
New
Undecided
Unassigned
18.10
Confirmed
Medium
Rebecca Blundell
19.04
In Progress
Medium
Unassigned

Bug Description

If you install a new site and go to http://mahara/admin/users/statistics.php when there are no blocks saved, you see

"Invalid argument supplied for foreach()", "~/code/mahara/htdocs/lib/stati...", 210, array(size 18)) at ~code/mahara/htdocs/lib/statistics.php:210, referer: http://mahara/admin/index.php

There is an invalid argument in this case as the value of $blocktypecounts is false and the code says:
foreach ($blocktypecounts as $blocktype) {
...get the details...
}
We should put it in an if statement to avoid the error.

Changed in mahara:
assignee: nobody → Rebecca Blundell (rjb-dev)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/9273

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

It will need to be checked if the issue also occurs in Mahara 18.04 and 17.10.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.