mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-76172 core: Fix error when userinfo is false
This patch should fix a regression introduced in MDL-75171, raised while running the OBv2.1 certification. The new method get_raw_userinfo() can return stdClass or false but the second one was not taken into account from get_userid() (so an error was thrown: "Argument 1 passed to core\oauth2\client::map_userinfo_to_fields() must be an instance of stdClass, bool given").
This commit is contained in:
parent
720bd60fc6
commit
ae63a2d16b
1 changed files with 5 additions and 1 deletions
|
@ -488,7 +488,7 @@ class client extends \oauth2_client {
|
|||
/**
|
||||
* Fetch the user info from the user info endpoint.
|
||||
*
|
||||
* @return array|false Moodle user fields for the logged in user (or false if request failed)
|
||||
* @return stdClass|false Moodle user fields for the logged in user (or false if request failed)
|
||||
* @throws moodle_exception if the response is empty after decoding it.
|
||||
*/
|
||||
public function get_raw_userinfo() {
|
||||
|
@ -528,6 +528,10 @@ class client extends \oauth2_client {
|
|||
*/
|
||||
public function get_userinfo() {
|
||||
$userinfo = $this->get_raw_userinfo();
|
||||
if ($userinfo === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->map_userinfo_to_fields($userinfo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue