异常 - 在 null 上调用成员函数 should_create_one_time_item_now()

问题描述 投票:0回答:1

我在现有的 Moodle 网站上安装了一个新主题,它开始运行良好,但是当我离开网站几分钟而不执行任何操作时,我收到此错误:

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()

但是,如果我关闭浏览器并再次打开它,错误就会消失,并且该网站运行良好。

我删除了moodledata中的这些文件,但错误仍然存在:cache,sessions,temp,localcache

Moodle版本:Moodle 4.2.5

主题:edly

moodle moodle-theme
1个回答
0
投票

这个问题在这里很难回答,错误出在 MathJax 过滤器中。我猜测 Moodle 在某个时候丢失了全局

$page
变量。它可能与主题相关,也可能无关。

我建议在 IDE 中使用 xdebug 或类似工具来单步执行代码,看看为什么

$page
为 null

也许添加一个断点

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

请参阅此处安装 xdebug -

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

© www.soinside.com 2019 - 2024. All rights reserved.