From 5c9b19399ab852bfe9d1cb9fc149bd054634eecc Mon Sep 17 00:00:00 2001 From: Friederich Loheide Date: Wed, 23 Sep 2026 16:42:29 +0000 Subject: [PATCH] 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) --- includes/class-m365-login-auth.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/class-m365-login-auth.php b/includes/class-m365-login-auth.php index 810e99a..9368cd7 100644 --- a/includes/class-m365-login-auth.php +++ b/includes/class-m365-login-auth.php @@ -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. *