Exception thrown after pressing "Change Theme"

Exception thrown after pressing "Change Theme"

by Caitlin Lawrence -
Number of replies: 6

Hi everyone,

I just created a new test site for myself and upgraded to Moodle 3.11.1+. I run Moodle through my XAMPP application from Apache Friends. I got a strange exception when I went into the Theme Selector and clicked on "Change Theme" in the Default device type. This is what I got:


Exception - Failed opening required '[dirroot]/lib/coursecatlib.php' (include_path='[dirroot]/lib/pear;C:\xampp\php\PEAR')

Has this happened to anyone else? How would I go about fixing this? Unfortunately I'm not well-versed so I'm not even too sure what this means.

Thanks!

Caitlin Lawrence

Average of ratings: -
In reply to Caitlin Lawrence

Re: Exception thrown after pressing "Change Theme"

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers
What theme are you trying to change to Caitlin? And what version of that theme?
In reply to Richard Oelmann

Re: Exception thrown after pressing "Change Theme"

by Caitlin Lawrence -
Richard,

I am trying to change to the Snap theme 3.10.3. However, this exception is thrown before I even get to the screen to show which themes are available to change to.
In reply to Caitlin Lawrence

Re: Exception thrown after pressing "Change Theme"

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers
You could try expanding the error reporting options to show developer level - all errors and find the stack trace that would allow you to identify the root cause of the issue?
In reply to Richard Oelmann

Re: Exception thrown after pressing "Change Theme"

by Caitlin Lawrence -
Richard,

Thank you for your help. This is what was shown in my PHP error log:

[26-Jul-2021 11:48:41 America/New_York] PHP Warning: require_once(C:\xampp\htdocs\moodle/lib/coursecatlib.php): Failed to open stream: No such file or directory in C:\xampp\htdocs\moodle\theme\snap\classes\local.php on line 26
[26-Jul-2021 11:48:41 America/New_York] Default exception handler: Exception - Failed opening required '[dirroot]/lib/coursecatlib.php' (include_path='[dirroot]/lib/pear;C:\xampp\php\PEAR') Debug:
Error code: generalexceptionmessage
* line 26 of \theme\snap\classes\local.php: Error thrown
* line 136 of \lib\classes\component.php: call to include_once()
* line 31 of \theme\snap\config.php: call to core_component::classloader()
* line 2297 of \lib\outputlib.php: call to include()
* line 698 of \lib\outputlib.php: call to theme_config::find_theme_config()
* line 178 of \theme\index.php: call to theme_config::load()

I uninstalled the Snap theme completely and removed it from the server to see what would happen. I clicked on "Change Theme" again and this time there was no error. So, it seems to just be a problem with the theme. I'm probably wrong, but to me it seems like with the Snap theme installed, it's trying to call the coursecatlib.php file which doesn't exist anymore in moodle/lib because it's deprecated. I guess nothing can really be done about it until the Snap theme is updated? It hasn't been updated for 2 months so I guess I should just switch to another theme for now if it doesn't work with the newest Moodle upgrade.
In reply to Caitlin Lawrence

Re: Exception thrown after pressing "Change Theme"

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers
I would agree with both your conclusions and solution.
Snap doesn't currently support 3.11 as released in the plugins database, though there is active development over the last week or so on its GitHub page https://github.com/open-lms-open-source/moodle-theme_snap so there may be a 3.11 version coming soon - or if you have a test server, you could test the github version, though I would definitely wait for a stable release for any live production Moodle.
In reply to Richard Oelmann

Re: Exception thrown after pressing "Change Theme"

by Caitlin Lawrence -
Thank you so much. I downloaded the updated 3.10 release on GitHub, installed it on my test server, and I'm able to use the Theme Selector now and choose the Snap theme. The only issue is that there's no CSS or JS styling applied so the pages look all wonky. Oh well. That's a whole other issue that may be solved in the Snap 3.11 release.