Toolbox.php error when attempting to sign in
Using Generic SSO type and attempting to log in to an azure tenant.
I am able to get through the whole login process but once it would normally redirect back to my GLPI instance, it throws the following:
Warning: Trying to access array offset on false in /var/www/html/glpi/src/Toolbox.php on line 1068 Warning: Trying to access array offset on false in /var/www/html/glpi/src/Toolbox.php on line 1071
My config is below
This is what shows when setting debug = true in provider.class.php
getAccessToken: Array ( [token_type] => Bearer [scope] => email openid profile User.Read [expires_in] => 4922 [ext_expires_in] => 4922 [access_token] => REDACT getResourceOwner: Array ( [@odata.context] => https://graph.microsoft.com/v1.0/$metadata#users/$entity [businessPhones] => Array ( [0] => REDACT [displayName] => REDACT [givenName] => REDACT [jobTitle] => REDACT [mail] => REDACT [mobilePhone] => +1 REDACT [officeLocation] => [preferredLanguage] => [surname] => REDACT [userPrincipalName] => REDACT (Matches email) [id] => REDACT syncOAuthPhoto:
It looks like this was happening because the user i was trying to access (and most of my users) don't have any sort of picture in Azure. Dupe of issue #115 but with a different fix than PR #121 . I would add a PR for this but not sure which way you want to go with it.
I added a check/bypass to provider.class.php to account for this
/**
* Synchronize picture (photo) of the user.
*
* @return string|boolean Filename to be stored in user picture field, false if no picture found
*/
public function syncOAuthPhoto($user) {
// Check if photo URL is provided
if (empty($profile['photo'])) {
Toolbox::logDebug("No photo URL provided in OAuth profile.");
return;
}
$data = @file_get_contents($profile['photo']);
$image = @imagecreatefromstring($data);
if ($image === false) {
Toolbox::logDebug("Invalid image data received from photo URL: " . $profile['photo']);
return;
}
There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days.
If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue.