// Init variable
$backTrace = '';
+ // Generate exception code
+ $exceptionCode = ($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode()));
+
// Get all call levels from backtrace
foreach ($exceptionInstance->getTrace() as $idx => $traceArray) {
// Init argument string
--------------------------------------------------------------------------------\n",
trim(html_entity_decode(strip_tags(get_class($exceptionInstance)))),
trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))),
- ($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode())),
+ $exceptionCode,
$exceptionInstance->getFile(),
$exceptionInstance->getLine(),
trim($backTrace)
// Output the message
print($message);
+
+ // Exit with code
+ exit(hexdec($exceptionCode));
} elseif (is_object($exceptionInstance)) {
// Output more details
printf('exceptionInstance=%s', print_r($exceptionInstance, true));
+ exit(255);
} else {
/*
* Invalid exception instance detected! Do *only* throw exceptions that
* outputs like above.
*/
printf('exceptionInstance[]=%s is invalid! Please inform the core developer team.' . PHP_EOL, gettype($exceptionInstance));
+ exit(255);
}
}
} else {
// Do not call this twice
trigger_error(__METHOD__ . ': Called twice.');
- exit;
+ exit(255);
}
}
} else {
// Trigger an error
trigger_error($stubMessage);
- exit;
+ exit(255);
}
}
} else {
// Trigger an error
trigger_error($message . "<br />\n");
- exit;
+ exit(255);
}
} else {
// @TODO Finish this part!
// Is this method already called?
if (isset($GLOBALS['app_die_called'])) {
// Then output the text directly
- exit($message);
+ print $message . PHP_EOL;
+ exit(255);
}
// This method shall not be called twice
// Do we have debug installation?
if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) {
// Abort here
- exit;
+ exit(255);
}
// Get some instances
$responseInstance->flushBuffer();
} catch (FileNotFoundException $e) {
// Even the template 'emergency_exit' wasn't found so output both message
- exit($message . ', exception: ' . $e->getMessage());
+ print ($message . ', exception: ' . $e->getMessage() . PHP_EOL);
+ exit($e->getCode());
}
// Good bye...
- exit;
+ exit(255);
} else {
// Output message and die
- die(sprintf('[Main:] Emergency exit reached: <span class="emergency_span">%s</span>',
- $message
- ));
+ printf('[Main:] Emergency exit reached: <span class="emergency_span">%s</span>', $message);
+ exit(255);
}
}