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

Incorrect exception syntax in get_course_and_cm_from_instance() for invalidmoduleid

    XMLWordPrintable

Details

    Description

      The exception thrown in /lib/modinfolib.php in get_course_and_cm_from_instance() has incorrect syntax:
      throw new moodle_exception('invalidmoduleid', 'error', $instanceid);
      While it should be:
      throw new moodle_exception('invalidmoduleid', 'error', null, $instanceid);

      This results in error messages displayed as "Invalid module ID: {$a}"

      According to the moodle_exception's constructor in /lib/setuplib.php the 3rd parameter is the link to the error page and only the 4th parameter is the content of {$a}

      To reproduce:
      <?php
      require_once(_DIR_ . '/config.php');
      throw new moodle_exception('invalidmoduleid', 'error', 11);

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              iv_enovation ivan matviyuk
              Andrew Lyons Andrew Lyons
              Ilya Tregubov Ilya Tregubov
              CiBoT CiBoT
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 26 minutes
                  26m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.