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

Standardise use of the cm_info object and fix type hinting where stdClass is still being used.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Workshop
    • Labels:
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Tomaz found a bug while attempting to use a workshop module on a recently upgraded site:

      Debug info: Argument 4 passed to workshop_extend_navigation() must be an instance of stdClass, instance of cm_info given, called in /html/lib/navigationlib.php on line 1529 and defined
      Stack trace:

         * line 351 of /lib/setuplib.php: coding_exception thrown
         * line 1310 of /mod/workshop/lib.php: call to default_error_handler()
         * line 1529 of /lib/navigationlib.php: call to workshop_extend_navigation()
         * line 1056 of /lib/navigationlib.php: call to global_navigation->load_activity()
         * line 2345 of /lib/navigationlib.php: call to global_navigation->initialise()
         * line 641 of /lib/pagelib.php: call to navbar->has_items()
         * line 4 of /theme/arialist/layout/general.php: call to moodle_page->has_navbar()
         * line 647 of /lib/outputrenderers.php: call to include()
         * line 605 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
         * line ? of unknownfile: call to core_renderer->header()
         * line 189 of /lib/outputrenderers.php: call to call_user_func_array()
         * line ? of unknownfile: call to plugin_renderer_base->__call()
         * line 67 of /mod/workshop/view.php: call to mod_workshop_renderer->header()

      The problem is because workshop_extend_navigation is type hinting $cm as a stdClass, and it recently changed to a cm_info object.

      I'll create a patch for this shortly.

      Cheers
      Sam

        Attachments

          Activity

            People

            • Assignee:
              samhemelryk Sam Hemelryk
              Reporter:
              samhemelryk Sam Hemelryk
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Feb/11