diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-07-01 12:07:51 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2019-07-01 12:07:51 +0300 |
commit | dd92f7a534b9141de5da1c55caa4b82515a8fac5 (patch) | |
tree | 6d818631ab700d004bc1400d8965496aa6523318 /plugins/Tour | |
parent | e8a67a8e1612d025acfcc9deb563bcb803e3ef69 (diff) |
Check $defaultLayout is an array when generating default dashboard (#14596)
fix https://github.com/matomo-org/matomo/issues/14595
Not sure why it wouldn't be an array. Even when using ` json_decode($defaultLayout);` compared to ` json_decode($defaultLayout, true);` it is an array on my instance and works nicely. Just in case there is some other plugin installed that changes it maybe, check if it is an array
Diffstat (limited to 'plugins/Tour')
-rw-r--r-- | plugins/Tour/Tour.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/Tour/Tour.php b/plugins/Tour/Tour.php index 15eee69ee7..bda6e41445 100644 --- a/plugins/Tour/Tour.php +++ b/plugins/Tour/Tour.php @@ -123,9 +123,9 @@ class Tour extends \Piwik\Plugin public function changeDefaultDashboardLayout(&$defaultLayout) { if (Piwik::hasUserSuperUserAccess()) { - $defaultLayout = json_decode($defaultLayout); + $defaultLayout = json_decode($defaultLayout, true); $engagementWidget = array('uniqueId' => 'widgetTourgetEngagement', 'parameters' => array('module' => 'Tour', 'action' => 'getEngagement')); - if (isset($defaultLayout[2])) { + if (is_array($defaultLayout) && isset($defaultLayout[2]) && is_array($defaultLayout[2])) { array_unshift($defaultLayout[2], $engagementWidget); } $defaultLayout = json_encode($defaultLayout); |