From b14cfb6d1b8462a7ba6ea3cc9b23186dbbb430f2 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 27 Jun 2024 22:42:12 +0100 Subject: [PATCH] MDL-82328 auth_oauth2: don't load custom profile field data too early. By prematurely loading custom profile data in the constructor, under specific circumstances it would happen before the page was fully initialised which meant that any attempt at applying filters when formatting profile field data would result in thrown exception. --- auth/oauth2/classes/auth.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auth/oauth2/classes/auth.php b/auth/oauth2/classes/auth.php index fd2343f6bea..d5dc5438bff 100644 --- a/auth/oauth2/classes/auth.php +++ b/auth/oauth2/classes/auth.php @@ -63,7 +63,6 @@ class auth extends \auth_plugin_base { public function __construct() { $this->authtype = 'oauth2'; $this->config = get_config('auth_oauth2'); - $this->customfields = $this->get_custom_user_profile_fields(); } /** @@ -310,7 +309,7 @@ class auth extends \auth_plugin_base { return $userdata; } - $allfields = array_merge($this->userfields, $this->customfields); + $allfields = array_merge($this->userfields, $this->get_custom_user_profile_fields()); // Go through each field from the external data. foreach ($externaldata as $fieldname => $value) {