-
Bug
-
Resolution: Fixed
-
Minor
-
4.2 regressions, 4.3.6, 4.4.2
Under specific circumstances that only davidcarrillo could ever invent (each morning), it's possible that when a user session expires, we get a consistent exception shown on the page and the site becomes unusable
The specific combination of settings required are as follows:
- There exists a custom user profile field of type Menu
- The MathJax filter is set to filter "Content and headings"
- The OAuth2 authentication module is enabled
In the above scenario, when a user session expires then we get the following warning on the screen:
Warning: Attempt to read property "requires" on null in /var/www/html/filter/mathjaxloader/filter.php on line 83
|
Along with the following exception:
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 114 of /lib/classes/formatting.php: call to filter_manager->setup_page_for_filters()
|
line 759 of /lib/weblib.php: call to core\formatting->format_string()
|
line 64 of /user/profile/field/menu/field.class.php: call to format_string()
|
line 637 of /user/profile/lib.php: call to profile_field_menu->__construct()
|
line 663 of /user/profile/lib.php: call to profile_get_user_field()
|
line 845 of /user/profile/lib.php: call to profile_get_user_fields_with_data()
|
line 616 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 3261 of /lib/moodlelib.php: call to auth_oauth2\auth->__construct()
|
line 463 of /lib/classes/session/manager.php: call to get_auth_plugin()
|
line 172 of /lib/classes/session/manager.php: call to core\session\manager::initialise_user_session()
|
line 144 of /lib/classes/session/manager.php: call to core\session\manager::start_session()
|
line 897 of /lib/setup.php: call to core\session\manager::start()
|
line 55 of /config.php: call to require_once()
|
line 30 of /index.php: call to require_once()
|
The stacktrace is interesting, because there is a lot happening there. Ultimately the problem is because the OAuth2 constructor tries to pre-empt user profile field loading instead of only doing so when actually required. This is a regression caused by MDL-61789
Running the following will indicate how every other authentication does the same:
$ git grep "\->get_custom_user_profile_fields" auth/
|
Trying to set the class property in the constructor is also a pointless premature optimisation because the method implementation already does exactly that in order to cache the result
- is a regression caused by
-
MDL-61789 Allow to choose custom profile fields from oAuth2 field mappings
- Closed