Exemplo n.º 1
0
 public function setPHPError($code, $message, $file, $line, $fatal = false)
 {
     if ($fatal) {
         // Generating stacktrace for PHP fatal errors is not possible,
         // since this code executes when the PHP process shuts down,
         // rather than at the time of the crash.
         //
         // In these situations, we generate a "stacktrace" containing only
         // the line and file number where the crash occurred.
         $stacktrace = Bugsnag_Stacktrace::fromFrame($this->config, $file, $line);
     } else {
         $stacktrace = Bugsnag_Stacktrace::generate($this->config);
     }
     $this->setName(Bugsnag_ErrorTypes::getName($code))->setMessage($message)->setSeverity(Bugsnag_ErrorTypes::getSeverity($code))->setStacktrace($stacktrace)->setCode($code);
     return $this;
 }
Exemplo n.º 2
0
 public function testCodeDisabled()
 {
     $config = new Bugsnag_Configuration();
     $config->sendCode = false;
     $stacktrace = Bugsnag_Stacktrace::fromFrame($config, $this->getFixturePath('code/File.php'), 1)->toArray();
     $this->assertCount(1, $stacktrace);
     $topFrame = $stacktrace[0];
     $this->assertArrayNotHasKey('code', $topFrame);
 }