4require_once 
'Services/Environment/classes/class.ilRuntime.php';
 
   16include_once 
'PEAR.php';
 
   57                $this->DEBUG_ENV = 
true;
 
   62                $this->error_obj = 
false;
 
   68                                array($this, 
'handleRuntimeErrors'),
 
   72                set_exception_handler(array($this, 
'handleUncaughtException'));
 
   77                return $this->error_obj;
 
   91                if ($a_error_obj->getCode() == 
null)
 
   96                $this->error_obj =& $a_error_obj;
 
   98                if (
$_SESSION[
"failure"] && substr($a_error_obj->getMessage(), 0, 22) != 
"Cannot find this block")
 
  100                        $m = 
"Fatal Error: Called raise error two times.<br>".
 
  101                                "First error: ".$_SESSION[
"failure"].
'<br>'.
 
  102                                "Last Error:". $a_error_obj->getMessage();
 
  104                        $log->logError($a_error_obj->getCode(), $m);
 
  109                if (substr($a_error_obj->getMessage(), 0, 22) == 
"Cannot find this block")
 
  113                                echo 
"<b>DEVMODE</b><br><br>";
 
  114                                echo 
"<b>Template Block not found.</b><br>";
 
  115                                echo 
"You used a template block in your code that is not available.<br>";
 
  116                                echo 
"Native Messge: <b>".$a_error_obj->getMessage().
"</b><br>";
 
  117                                if (is_array($a_error_obj->backtrace))
 
  119                                        echo 
"Backtrace:<br>";
 
  120                                        foreach ($a_error_obj->backtrace as $b)
 
  122                                                if ($b[
"function"] == 
"setCurrentBlock" &&
 
  123                                                        basename($b[
"file"]) != 
"class.ilTemplate.php")
 
  127                                                echo 
"File: ".$b[
"file"].
", ";
 
  128                                                echo 
"Line: ".$b[
"line"].
", ";
 
  129                                                echo $b[
"function"].
"()<br>";
 
  130                                                if ($b[
"function"] == 
"setCurrentBlock" &&
 
  131                                                        basename($b[
"file"]) != 
"class.ilTemplate.php")
 
  142                if (is_object(
$log) and 
$log->enabled == 
true)
 
  144                        $log->logError($a_error_obj->getCode(),$a_error_obj->getMessage());
 
  148                if ($a_error_obj->getCode() == $this->FATAL)
 
  150                        trigger_error(stripslashes($a_error_obj->getMessage()), E_USER_ERROR);
 
  154                if ($a_error_obj->getCode() == $this->WARNING)
 
  156                        if ($this->DEBUG_ENV)
 
  158                                $message = $a_error_obj->getMessage();
 
  162                                $message = 
"Under Construction";
 
  167                        if (!defined(
"ILIAS_MODULE"))
 
  177                if ($a_error_obj->getCode() == $this->MESSAGE)
 
  179                        $_SESSION[
"failure"] = $a_error_obj->getMessage();
 
  185                                $dirname = dirname($_SERVER[
"PHP_SELF"]);
 
  186                                $ilurl = parse_url(ILIAS_HTTP_PATH);
 
  187                                $subdir = substr(strstr($dirname,$ilurl[
"path"]),strlen($ilurl[
"path"]));
 
  192                                        $num_subdirs = substr_count($subdir,
"/");
 
  194                                        for ($i=1;$i<=$num_subdirs;$i++)
 
  220                return $this->message;
 
  224                $this->message = $a_message;
 
  230                        $this->message .= 
"<br /> ";
 
  232                $this->message .= $a_message;
 
  251                                $ilLog->write(
'PHP errror: '.$errstr.
'. FATAL error on line '.$errline.
' in file '.$errfile);
 
  256                                $ilLog->write(
'PHP warning: ['.$errno.
'] '.$errstr.
' on line '.$errline.
' in file '.$errfile);
 
  269                $error = $e->getMessage();
 
  272                        $error.= 
'<br /><br />';
 
  273                        $error.= nl2br($e->getTraceAsString());
 
  292                if(error_reporting() === 0)
 
  302                        error_log($error_code . 
': ' . $a_error_message . 
' in '.$a_error_file . 
' on line ' . $a_error_line . PHP_EOL . implode(PHP_EOL, $backtrace_array));
 
  307                        print '<br /><b>' . $error_code . 
'</b>: ' . $a_error_message . 
' in <b>'.$a_error_file . 
'</b> on line <b>' . $a_error_line . 
'</b><br/>' . implode(
'<br />', $backtrace_array);
 
  322                unset($a_backtrace[0]); 
 
  323                foreach($a_backtrace as $item)
 
  325                        $stack_line = 
"#$i " . $item[
'file'] . 
"(" . $item[
'line'] . 
"): ";
 
  326                        if(isset($item[
'class']))
 
  328                                $stack_line .= $item[
'class'] . 
"->";
 
  330                        $stack_line .= $item[
'function'] . 
"()";
 
  331                        array_push($stack, $stack_line);
 
  345                $constants = get_defined_constants(
true);
 
  346                foreach($constants[
'Core'] as $constant => $value)
 
  348                        if(substr($constant, 0, 2) == 
'E_' && $value == $error_code)
 
PEAR($error_class=null)
Constructor.
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Error Handling & global info handling uses PEAR error class.
ilErrorHandling()
Constructor @access public.
errorHandler($a_error_obj)
defines what has to happen in case of error @access private
handleRuntimeErrors($a_error_code, $a_error_message, $a_error_file, $a_error_line)
We should enhance the error reporting in future releases (funding required).
translateErrorCode($error_code)
Translates an integer error code to the corresponding error string.
static _ilErrorWriter($errno, $errstr, $errfile, $errline)
This is used in Soap calls to write PHP error in ILIAS Logfile Not used yet!!!
handleUncaughtException(Exception $e)
Called for each uncaught exception.
appendMessage($a_message)
formatBacktraceArray(array $a_backtrace)
static redirect($a_script)
http redirect to other script