moodlemoodle-theme

Exception - Call to a member function should_create_one_time_item_now() on null


I have installed a new theme on the existing Moodle website, it started working well but when I left the website for a couple of minutes without doing anything I got this error:

Exception - Call to a member function should_create_one_time_item_now() on
null
Debug info:
Error code: generalexceptionmessage
Stack trace:
• line 83 of /filter/mathjaxloader/filter.php: Error thrown
• line 275 of /lib/filterlib.php: call to filter_mathjaxloader->setup()
• line 1592 of /lib/weblib.php: call to filter_manager->setup_page_for_filters()
• line 64 of /user/profile/field/menu/field.class.php: call to format_string()
• line 616 of /user/profile/lib.php: call to profile_field_menu->_construct()
• line 642 of /user/profile/lib.php: call to profile_get_user_field()
• line 847 of /user/profile/lib.php: call to profile_get_user_fields_with_data()
• line 613 of /lib/authlib.php: call to profile_get_custom_fields()
• line 66 of /auth/oauth2/classes/auth.php: call to auth_plugin_base- >get_custom_user_profile_fields()
• line 3811 of /lib/moodlelib.php: call to auth_oauth2\auth->_construct()
• line 461 of /lib/classes/session/manager.php: call to get_auth_plugin()
• line 170 of /lib/classes/session/manager.php: call to core\session\manager::initialise_user_session()
• line 142 of /lib/classes/session/manager.php: call to core\session\manager::start_session()
• line 851 of /lib/setup.php: call to core\session\manager::start()
• line 31 of /config.php: call to require_once()
• line 30 of /index.php: call to require_once()

But if I close the browser and open it again the error is gone and the The website works well.

I removed these files in moodledata, but the error still exists: cache, sessions, temp, localcache

Moodle version:Moodle 4.2.5

Theme:edly


Solution

  • That's going to be difficult to answer on here, the error is in in the MathJax filter. I'm guessing Moodle has lost the global $page variable at some point. It might or might not be related to the theme.

    I would suggest using xdebug or similar in your IDE to step through the code to see why $page is null

    Maybe add a breakpoint at

    line 1592 of /lib/weblib.php: call to filter_manager->setup_page_for_filters()
    

    See here for installing xdebug -

    https://moodledev.io/docs/guides/profiling#xdebug