diff --git a/core/dispatch.php b/core/dispatch.php index 7f04a15664b04433a75584fad6c90885fc69b631..86b810500a685ddc75a79ad9046a3b2cc8d10deb 100644 --- a/core/dispatch.php +++ b/core/dispatch.php @@ -35,9 +35,7 @@ if (PIWIK_ENABLE_DISPATCH) { $controller->init(); $response = $controller->dispatch(); - if (is_array($response)) { - var_export($response); - } elseif (!is_null($response)) { + if (!is_null($response)) { echo $response; } } catch (Exception $ex) { diff --git a/plugins/API/Controller.php b/plugins/API/Controller.php index 18e39d58a2f34da3dd28da405236ca38df30b507..d11f953704f79b25e0652ee1bdeba08476b056c1 100644 --- a/plugins/API/Controller.php +++ b/plugins/API/Controller.php @@ -30,7 +30,13 @@ class Controller extends \Piwik\Plugin\Controller } $request = new Request('token_auth=' . Common::getRequestVar('token_auth', 'anonymous', 'string')); - return $request->process(); + $response = $request->process(); + + if (is_array($response)) { + $response = var_export($response, true); + } + + return $response; } public function listAllMethods()