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

Condition on $section in course/view.php assumes positive numbers and prevents format plugins from using negatives for designated displays

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.2
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide

      Regression testing only:

      1. Add a new course
      2. Set format to topics
      3. Set 'course display' to one section per page
      4. Visit a single section
      5. VERIFY: that a log entry has been added for viewing the single section
      Show
      Regression testing only: Add a new course Set format to topics Set 'course display' to one section per page Visit a single section VERIFY: that a log entry has been added for viewing the single section
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE

      Description

      Around line 101 in course/view.php

      if (!empty($section)) {

      assumes positive section numbers (that is, $section > 0) or else throws an exception at

      $modinfo->get_section_info($section, MUST_EXIST);

      However, format plugins may use negative section numbers to control the display. The whole condition seems to merely serve logging and so seems unnecessarily too strong.

      The condition could be replaced with

      if ($section and $section > 0) {

      to get the same effect and still allow format plugins more flexibility.

        Attachments

          Activity

            People

            Assignee:
            poltawski Dan Poltawski
            Reporter:
            itamart Itamar Tzadok
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Frédéric Massart
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Sep/12