Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-74254

Exception on my/courses page

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0
    • 4.0
    • Blocks

    Description

      When user does not have capability to view course catalog, my courses page throws an error

      Exception - Argument 1 passed to core_course_category::get_nearest_editable_subcategory() must be an instance of core_course_category, null given, called in [dirroot]/my/courses.php on line 67
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:
       
          line 3189 of /course/classes/category.php: TypeError thrown
          line 67 of /my/courses.php: call to core_course_category::get_nearest_editable_subcategory()
       
      Exception - Call to a member function can_create_course() on null
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:
       
          line 415 of /blocks/myoverview/classes/output/main.php: Error thrown
          line 46 of /blocks/myoverview/classes/output/renderer.php: call to block_myoverview\output\main->export_for_template()
          line 488 of /lib/outputrenderers.php: call to block_myoverview\output\renderer->render_main()
          line 62 of /blocks/myoverview/block_myoverview.php: call to plugin_renderer_base->render()
          line 341 of /blocks/moodleblock.class.php: call to block_myoverview->get_content()
          line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
          line 1222 of /lib/blocklib.php: call to block_base->get_content_for_output()
          line 1280 of /lib/blocklib.php: call to block_manager->create_block_contents()
          line 685 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
          line 219 of /lib/mustache/src/Mustache/Context.php: call to core_renderer->standard_head_html()
          line 138 of /lib/mustache/src/Mustache/Context.php: call to Mustache_Context->findVariableInStack()
          line 31 of data/localcache/mustache/1647538853/boost/__Mustache_5d2c5b634f028cc9d1e1a83931c95cb2.php: call to Mustache_Context->findDot()
          line 13 of data/localcache/mustache/1647538853/boost/__Mustache_a1ebd1a6f202c9e6ea188176c7924985.php: call to __Mustache_5d2c5b634f028cc9d1e1a83931c95cb2->renderInternal()
          line 67 of /lib/mustache/src/Mustache/Template.php: call to __Mustache_a1ebd1a6f202c9e6ea188176c7924985->renderInternal()
          line 201 of /lib/outputrenderers.php: call to Mustache_Template->render()
          line 113 of /theme/boost/layout/drawers.php: call to renderer_base->render_from_template()
          line 1472 of /lib/outputrenderers.php: call to include()
          line 1398 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
          line 2951 of /lib/outputrenderers.php: call to core_renderer->header()
          line 390 of /lib/setuplib.php: call to core_renderer->fatal_error()
          line ? of unknownfile: call to default_exception_handler()
      

      To reproduce:

      • Remove capability moodle/category:viewcourselist from Authenticated user role
      • Login as a regular user and go to "My courses"

      Attachments

        Issue Links

          Activity

            People

              marina Marina Glancy
              marina Marina Glancy
              Simey Lameze Simey Lameze
              Jun Pataleta Jun Pataleta
              Gladys Basiana Gladys Basiana
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h