Beispiel #1
0
 public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false)
 {
     // Deprecation warning.
     MLog::add('MException is deprecated.', MLog::WARNING, 'deprecated');
     $this->level = $level;
     $this->code = $code;
     $this->message = $msg;
     if ($info != null) {
         $this->info = $info;
     }
     if ($backtrace && function_exists('debug_backtrace')) {
         $this->backtrace = debug_backtrace();
         for ($i = count($this->backtrace) - 1; $i >= 0; --$i) {
             ++$i;
             if (isset($this->backtrace[$i]['file'])) {
                 $this->file = $this->backtrace[$i]['file'];
             }
             if (isset($this->backtrace[$i]['line'])) {
                 $this->line = $this->backtrace[$i]['line'];
             }
             if (isset($this->backtrace[$i]['class'])) {
                 $this->class = $this->backtrace[$i]['class'];
             }
             if (isset($this->backtrace[$i]['function'])) {
                 $this->function = $this->backtrace[$i]['function'];
             }
             if (isset($this->backtrace[$i]['type'])) {
                 $this->type = $this->backtrace[$i]['type'];
             }
             $this->args = false;
             if (isset($this->backtrace[$i]['args'])) {
                 $this->args = $this->backtrace[$i]['args'];
             }
             break;
         }
     }
     // Store exception for debugging purposes!
     MError::addToStack($this);
     parent::__construct($msg, (int) $code);
 }