From cfd8e5114889c5b1cecf117f40e83a1c2e22213d Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@gmail.com>
Date: Sun, 7 Aug 2016 12:38:05 +0000
Subject: [PATCH] fix some warnings

---
 plugins/API/API.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/API/API.php b/plugins/API/API.php
index 7548cf312b..b3d2fa49a8 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -276,7 +276,11 @@ class API extends \Piwik\Plugin\API
                                       $showSubtableReports = false, $idSite = false)
     {
         if (empty($idSite) && !empty($idSites)) {
-            $idSite = array_shift($idSites);
+            if (is_array($idSites)) {
+                $idSite = array_shift($idSites);
+            } else {
+                $idSite = $idSites;
+            }
         } elseif (empty($idSites)) {
             throw new \Exception('Calling API.getReportMetadata without any idSite is no longer supported since Piwik 3.0.0. Please specifiy at least one idSite via the "idSite" parameter.');
         }
-- 
GitLab