5require_once 
'Services/Environment/classes/class.ilRuntime.php';
 
   19include_once 
'PEAR.php';
 
   22require_once(
"./Services/Exceptions/lib/Whoops/Run.php");
 
   23require_once(
"./Services/Exceptions/lib/Whoops/Handler/HandlerInterface.php");
 
   24require_once(
"./Services/Exceptions/lib/Whoops/Handler/Handler.php");
 
   25require_once(
"./Services/Exceptions/lib/Whoops/Handler/CallbackHandler.php");
 
   26require_once(
"./Services/Exceptions/lib/Whoops/Handler/PrettyPageHandler.php");
 
   27require_once(
"./Services/Exceptions/lib/Whoops/Exception/Inspector.php");
 
   28require_once(
"./Services/Exceptions/lib/Whoops/Exception/ErrorException.php");
 
   29require_once(
"./Services/Exceptions/lib/Whoops/Exception/FrameCollection.php");
 
   30require_once(
"./Services/Exceptions/lib/Whoops/Exception/Frame.php");
 
   31require_once(
"./Services/Exceptions/lib/Whoops/Exception/Inspector.php");
 
   32require_once(
"./Services/Exceptions/lib/Whoops/Exception/Formatter.php");
 
   33require_once(
"./Services/Exceptions/lib/Whoops/Util/TemplateHelper.php");
 
   34require_once(
"./Services/Exceptions/lib/Whoops/Util/Misc.php");
 
   36require_once(
"Services/Exceptions/classes/class.ilDelegatingHandler.php");
 
   37require_once(
"Services/Exceptions/classes/class.ilPlainTextHandler.php");
 
   38require_once(
"Services/Exceptions/classes/class.ilTestingHandler.php");
 
   90                $this->DEBUG_ENV = 
true;
 
   95                $this->error_obj = 
false;
 
  109                if (self::$handlers_registered) {
 
  119                if ($ilRuntime->shouldLogErrors()) {
 
  120                        $whoops->pushHandler($this->loggingHandler());
 
  125                self::$handlers_registered = 
true;
 
  150                return $this->error_obj;
 
  164                if ($a_error_obj->getCode() == 
null)
 
  169                $this->error_obj =& $a_error_obj;
 
  171                if (
$_SESSION[
"failure"] && substr($a_error_obj->getMessage(), 0, 22) != 
"Cannot find this block")
 
  173                        $m = 
"Fatal Error: Called raise error two times.<br>".
 
  174                                "First error: ".$_SESSION[
"failure"].
'<br>'.
 
  175                                "Last Error:". $a_error_obj->getMessage();
 
  178                        #$log->writeWarning($m); 
  179                        #$log->logError($a_error_obj->getCode(), $m); 
  184                if (substr($a_error_obj->getMessage(), 0, 22) == 
"Cannot find this block")
 
  188                                echo 
"<b>DEVMODE</b><br><br>";
 
  189                                echo 
"<b>Template Block not found.</b><br>";
 
  190                                echo 
"You used a template block in your code that is not available.<br>";
 
  191                                echo 
"Native Messge: <b>".$a_error_obj->getMessage().
"</b><br>";
 
  192                                if (is_array($a_error_obj->backtrace))
 
  194                                        echo 
"Backtrace:<br>";
 
  195                                        foreach ($a_error_obj->backtrace as $b)
 
  197                                                if ($b[
"function"] == 
"setCurrentBlock" &&
 
  198                                                        basename($b[
"file"]) != 
"class.ilTemplate.php")
 
  202                                                echo 
"File: ".$b[
"file"].
", ";
 
  203                                                echo 
"Line: ".$b[
"line"].
", ";
 
  204                                                echo $b[
"function"].
"()<br>";
 
  205                                                if ($b[
"function"] == 
"setCurrentBlock" &&
 
  206                                                        basename($b[
"file"]) != 
"class.ilTemplate.php")
 
  217                if (is_object(
$log) and 
$log->enabled == 
true)
 
  219                        $log->write($a_error_obj->getMessage());
 
  220                        #$log->logError($a_error_obj->getCode(),$a_error_obj->getMessage()); 
  224                if ($a_error_obj->getCode() == $this->FATAL)
 
  226                        trigger_error(stripslashes($a_error_obj->getMessage()), E_USER_ERROR);
 
  230                if ($a_error_obj->getCode() == $this->WARNING)
 
  232                        if ($this->DEBUG_ENV)
 
  234                                $message = $a_error_obj->getMessage();
 
  238                                $message = 
"Under Construction";
 
  243                        if (!defined(
"ILIAS_MODULE"))
 
  253                if ($a_error_obj->getCode() == $this->MESSAGE)
 
  255                        $_SESSION[
"failure"] = $a_error_obj->getMessage();
 
  261                                $dirname = dirname(
$_SERVER[
"PHP_SELF"]);
 
  262                                $ilurl = parse_url(ILIAS_HTTP_PATH);
 
  263                                $subdir = substr(strstr($dirname,$ilurl[
"path"]),strlen($ilurl[
"path"]));
 
  268                                        $num_subdirs = substr_count($subdir,
"/");
 
  270                                        for ($i=1;$i<=$num_subdirs;$i++)
 
  296                return $this->message;
 
  300                $this->message = $a_message;
 
  306                        $this->message .= 
"<br /> ";
 
  308                $this->message .= $a_message;
 
  327                                $ilLog->write(
'PHP errror: '.$errstr.
'. FATAL error on line '.$errline.
' in file '.$errfile);
 
  332                                $ilLog->write(
'PHP warning: ['.$errno.
'] '.$errstr.
' on line '.$errline.
' in file '.$errfile);
 
  369                        if ($exception instanceof \
Whoops\Exception\ErrorException
 
  370                        and $exception->getCode() == E_ERROR) {
 
  371                                global $tpl, $lng, $tree;
 
  372                                $_SESSION[
"failure"] = $exception->getMessage();
 
  373                                include(
"error.php");
 
  377                        require_once(
"Services/Utilities/classes/class.ilUtil.php");
 
  385                                if (class_exists(
"ilInitialisation"))
 
  387                                        ilInitialisation::initHTML();
 
  389                                        include(
"error.php");                
 
  406                switch (ERROR_HANDLER) {
 
  415                                        $ilLog->write(
"Unknown or undefined error handler '".ERROR_HANDLER.
"'. " 
  416                                                                 .
"Falling back to PrettyPageHandler.");
 
  426        protected function loggingHandler() {
 
  436                        $log_message = $self->logMessageFor($exception, (
bool)LOG_ERROR_TRACE);
 
  440                                $ilLog->write($log_message, 300);
 
  458                assert(
'is_bool($log_trace)');
 
  459                $prefix = 
"PHP Error: ";
 
  460                if ($exception instanceof \
Whoops\Exception\ErrorException) {
 
  461                        switch ($exception->getCode()) {
 
  464                                        $prefix = 
"PHP Fatal error: ";
 
  468                $msg = $prefix.$exception->getMessage().
" in ".$exception->getFile().
" on line ".$exception->getLine();
 
  471                        $msg .= 
"\n".$exception->getTraceAsString();
 
PEAR($error_class=null)
Constructor.
Wrapper for Closures passed as handlers.
ilErrorHandling()
Constructor @access public.
static $handlers_registered
logMessageFor(Exception $exception, $log_trace)
Get the error message to be logged.
errorHandler($a_error_obj)
defines what has to happen in case of error @access private
devmodeHandler()
Get the handler to be used in DEVMODE.
getWhoops()
Get an instance of Whoops/Run.
static _ilErrorWriter($errno, $errstr, $errfile, $errline)
This is used in Soap calls to write PHP error in ILIAS Logfile Not used yet!!!
getIlRuntime()
Get ilRuntime.
isDevmodeActive()
Is the DEVMODE switched on?
getHandler()
Get a handler for an error or exception.
defaultHandler()
Get a default error handler.
initHandlers()
Initialize Error and Exception Handlers.
appendMessage($a_message)
A Whoops error handler for testing.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Whoops - php errors for cool kids.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']