In certain situations (see testing instructions for an example), Moodle breaks while building the navigation tree. A "coding exception" message is displayed to the user.
This occurs when a category of at least 2nd level is added to the navigation tree, in global_navigation::load_all_categories() .
The problematic piece of code is near line 1454. The code tries to add all parent categories of a give category to the navigation tree, but fails to handle the root category (id=0) correctly.
See patch attached for details of the problem. Note that this patch also fixes
The database needs to contain a course category, and a subcategory of it.
- Log in as admin
- Navigate to: Site administration -> Courses -> Add/edit courses
- Click on the name of the subcategory.
- "Coding exception" message is now displayed.