private function getMessage(\Exception $exception)
 {
     if ($exception instanceof \ErrorException) {
         return ErrorHandler::getErrNoString($exception->getSeverity()) . ' - ' . $exception->getMessage();
     }
     return $exception->getMessage();
 }
Beispiel #2
0
 private function init()
 {
     $this->handleFatalErrors();
     if ($this->isDebugModeEnabled()) {
         ErrorHandler::registerErrorHandler();
         ExceptionHandler::setUp();
         Common::printDebug("Debug enabled - Input parameters: ");
         Common::printDebug(var_export($_GET, true));
     }
 }
 private function setPiwikErrorHandling()
 {
     ErrorHandler::registerErrorHandler();
     error_reporting(E_ALL);
 }
Beispiel #4
0
<?php

/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @package Piwik
 */
use Piwik\ErrorHandler;
use Piwik\ExceptionHandler;
use Piwik\FrontController;
if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
    ErrorHandler::registerErrorHandler();
    ExceptionHandler::setUp();
}
FrontController::setUpSafeMode();
if (!defined('PIWIK_ENABLE_DISPATCH')) {
    define('PIWIK_ENABLE_DISPATCH', true);
}
if (PIWIK_ENABLE_DISPATCH) {
    $environment = new \Piwik\Application\Environment(null);
    $environment->init();
    $controller = FrontController::getInstance();
    try {
        $controller->init();
        $response = $controller->dispatch();
        if (!is_null($response)) {
            echo $response;
        }
 private static function getHtmlMessage($errno, $errstr, $errfile, $errline, $trace)
 {
     $trace = Log::$debugBacktraceForTests ?: $trace;
     $message = ErrorHandler::getErrNoString($errno) . ' - ' . $errstr;
     $html = "<p>There is an error. Please report the message (Piwik " . (class_exists('Piwik\\Version') ? Version::VERSION : '') . ")\n        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search firit might have been reported already!).</p>";
     $html .= "<p><strong>{$message}</strong> in <em>{$errfile}</em>";
     $html .= " on line {$errline}</p>";
     $html .= "Backtrace:<pre>";
     $html .= str_replace("\n", "\n", $trace);
     $html .= "</pre>";
     return $html;
 }