diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-31 00:35:53 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-12-31 00:35:53 +0300 |
commit | 5b06a62ae0d33f56cf22282d7cbe942bd59dea77 (patch) | |
tree | ea7c7589be3376373d7b2b49bbcd18a2d188c0d6 /core/Tracker.php | |
parent | 71010d19bde2d25d882f01c1f4f152beca70f18b (diff) |
Send HTTP status 500 for fatal errors in the tracker
Diffstat (limited to 'core/Tracker.php')
-rw-r--r-- | core/Tracker.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/Tracker.php b/core/Tracker.php index 802f025cca..5bf6a9b4e1 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -73,6 +73,8 @@ class Tracker private function init() { + $this->handleFatalErrors(); + \Piwik\FrontController::createConfigObject(); if ($this->isDebugModeEnabled()) { @@ -292,4 +294,13 @@ class Tracker } } + private function handleFatalErrors() + { + register_shutdown_function(function () { + $lastError = error_get_last(); + if (!empty($lastError) && $lastError['type'] == E_ERROR) { + Common::sendResponseCode(500); + } + }); + } } |