For example throwing a PermissionDeniedException would cause a stacktrace to be printed, even though it is not meant to be an error in terms of a critical exception.
/**
* Returns true if the debug mode is enabled, otherwise false.
*
+ * @param boolean $ignoreACP
* @return boolean
*/
- public static function debugModeIsEnabled() {
+ public static function debugModeIsEnabled($ignoreACP = false) {
// ACP override
- if (self::$overrideDebugMode) {
+ if (!$ignoreACP && self::$overrideDebugMode) {
return true;
}
else if (defined('ENABLE_DEBUG_MODE') && ENABLE_DEBUG_MODE) {
'returnValues' => $returnValues
);
- if (WCF::debugModeIsEnabled()) {
+ // include a stacktrace if:
+ // - debug mode is enabled
+ // - within ACP and a SystemException was thrown
+ if (WCF::debugModeIsEnabled(false) || WCF::debugModeIsEnabled() && self::INTERNAL_ERROR) {
$responseData['stacktrace'] = nl2br($stacktrace);
}