Skip to content

Commit

Permalink
Move debug backtrace of auth_oidc error details from Moodle log to PH…
Browse files Browse the repository at this point in the history
…P error log
  • Loading branch information
weilai-irl committed Feb 4, 2025
1 parent 61a5699 commit 2f504e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions auth/oidc/classes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,26 @@ public static function tostring($val) {
public static function debug($message, $where = '', $debugdata = null) {
$debugmode = (bool)get_config('auth_oidc', 'debugmode');
if ($debugmode === true) {
$backtrace = debug_backtrace();
$debugbacktrace = debug_backtrace();
$debugbacktracechecksum = md5(json_encode($debugbacktrace));

$otherdata = static::make_json_safe([
'other' => [
'message' => $message,
'where' => $where,
'debugdata' => $debugdata,
'backtrace' => $backtrace,
'backtrace_checksum' => $debugbacktracechecksum,
],
]);
$event = action_failed::create($otherdata);
$event->trigger();

$debugbacktracedata = [
'checksum' => $debugbacktracechecksum,
'backtrace' => $debugbacktrace,
];

debugging(json_encode($debugbacktracedata), DEBUG_DEVELOPER);
}
}

Expand Down

0 comments on commit 2f504e7

Please sign in to comment.