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
path: root/core
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2018-01-06 01:46:05 +0300
committerStefan Giehl <stefan@piwik.org>2018-01-06 01:46:05 +0300
commit66ba4e4f9a55802124170c4f84a1b07fa38436e5 (patch)
tree2d744cf7bb07424dd025823f281473fb86beb1a1 /core
parent4e9722c7413426c2ad91b6d4acc1abe23626e4ea (diff)
API: when an invalid format is specified, keep the error message shorter (#12401)
so we do not show the stack trace in that case, follows up https://github.com/piwik/piwik/pull/12357 eg on https://demo.piwik.org/?module=API&method=VisitsSummary.getVisits&idSite=1&period=day&date=last10&format=xmls&token_auth=x
Diffstat (limited to 'core')
-rw-r--r--core/ExceptionHandler.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php
index a6e2c075e4..6c01785b95 100644
--- a/core/ExceptionHandler.php
+++ b/core/ExceptionHandler.php
@@ -67,7 +67,13 @@ class ExceptionHandler
{
Common::sendHeader('Content-Type: text/html; charset=utf-8');
- echo self::getErrorResponse($exception);
+ try {
+ echo self::getErrorResponse($exception);
+ } catch(Exception $e) {
+ // When there are failures while generating the HTML error response itself,
+ // we simply print out the error message instead.
+ echo $exception->getMessage();
+ }
exit(1);
}