AUTH_OIDC customicon: Error when setting or deleting custom icon file for OIDC Login #2793
Labels
Issue type - bug
Bugs in existing code that needs to be fixed.
Plugin - auth_oidc
Status - PR ready / pending release
Dev is done and PR ready. Will be included in the next release.
Milestone
I recently upgraded from Moodle 3.9 to LTS Version 4.5.1. I now have installed OpenID Connect Plugin version 4.5.0 2024100700.
Problem: Whenever I try to change oder delete the customicon for OIDC Authentication in Moodle Settings an error is thrown.
Uploading an icon file in OIDC settings (auth_oidc | customicon) and saving settings:
Error: Call to a member function copy_content_to() on bool
Debug-Info:
Error code: generalexceptionmessage
Stack trace:
• line 115 of /auth/oidc/lib.php: Error thrown
• line 10715 of /lib/adminlib.php: call to auth_oidc_initialize_customicon()
• line 8990 of /lib/adminlib.php: call to admin_setting_configstoredfile->post_write_settings()
• line 59 of /admin/settings.php: call to admin_write_settings()
Result: New icon file is uploaded and shown in OIDC settings (it is saved and can be downloaded afterwards) but it is not displayed in the OIDC login window. Instead the old customicon file ist displayed and does not change.
Checking the filebase the already existing icon file was not overwritten: moodledata/pix_plugins/auth/oidc/0/customicon.jpg
Expected behavior: Provider-Icon should also change in frontend in the login window.
Deleting the icon file in OIDC settings (auth_oidc | customicon) and saving settings:
Error: Call to a member function is_directory() on string
Debug-Info:
Error code: generalexceptionmessage
Stack trace:
• line 101 of /auth/oidc/lib.php: Error thrown
• line 10715 of /lib/adminlib.php: call to auth_oidc_initialize_customicon()
• line 8990 of /lib/adminlib.php: call to admin_setting_configstoredfile->post_write_settings()
• line 59 of /admin/settings.php: call to admin_write_settings()
Result: Icon file was deleted from OIDC settings and in the login window now the standard icon is displayed.
Suggestions:
When looking into the code it seems that the function
$file = $fs->get_file_by_hash(sha1($fullpath)
somehow seems to fail and does not deliver a valid file handle. So the methods$file->copy_content_t
and$file->is_directory
are also failing. Btw. the code seems not quite accurate because I think the function should return with "false" in this case and not throw a PHP error.> Link to Github
Looking for the file in the database:

SELECT * FROM 'mdl_files' where 'component' = 'auth_oidc';
gives the following result:
Please help and advise what I could check furthermore. I originally suspected file permission problems but could not find an issue.
The text was updated successfully, but these errors were encountered: