Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2019-07-01 12:07:51 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2019-07-01 12:07:51 +0300
commitdd92f7a534b9141de5da1c55caa4b82515a8fac5 (patch)
tree6d818631ab700d004bc1400d8965496aa6523318
parente8a67a8e1612d025acfcc9deb563bcb803e3ef69 (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
-rw-r--r--plugins/Tour/Tour.php4
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);