Restore the debug log helper of the auth component

701e85a removed M365_Login_Auth::log() while it is still called on every
failure path of the callback (token exchange, token verification,
object ID mismatch, group checks). Those sign-ins ended in a PHP fatal
error instead of the error message on the login page.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-23 16:42:29 +00:00
parent 9f77e9027f
commit 5c9b19399a

View file

@ -796,6 +796,17 @@ class M365_Login_Auth {
); );
} }
/**
* Writes a diagnostic line to the debug log (only with WP_DEBUG and WP_DEBUG_LOG; never tokens or secrets).
*
* @param string $message Message.
*/
private function log( $message ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
error_log( '[M365 Login] ' . $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
}
}
/** /**
* Aborts the flow and shows a generic error on the login screen. * Aborts the flow and shows a generic error on the login screen.
* *