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

FileManager Exception when editing course settings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.4.4, 3.5.1, 3.6
    • Fix Version/s: 3.4.4, 3.5.1, 3.6
    • Component/s: Filepicker
    • Labels:
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull Master Branch:
      MDL-63231-set-default-value-for-int-param-MOODLE_Master
    • Testing Instructions:
      Hide
      Setup
      1. Create a course with a teacher enrolled
      Test
      1. Navigate to Site Administration|Users|Permissions
      2. Edit teacher role and uncheck: Change course summary (moodle/course:changesummary) capability
      3. Save changes
      4. Login as the teacher
      5. Access course
      6. Access course edit settings
      7. Perform some changes in settings like updating Course format from weekly to topics
      8. Save the changes.
      9. Confirm that you don't see any error message.
      Show
      Setup Create a course with a teacher enrolled Test Navigate to Site Administration|Users|Permissions Edit teacher role and uncheck: Change course summary (moodle/course:changesummary) capability Save changes Login as the teacher Access course Access course edit settings Perform some changes in settings like updating Course format from weekly to topics Save the changes. Confirm that you don't see any error message.

      Description

      When a teacher tries to edit the course settings, it finds an exception when the teacher role does not have the moodle/course:changesummary capability. This capability is enabled by default but it is possible that some sites disabled it for some client policies.

      Exception - Argument 1 passed to file_get_all_files_in_draftarea() must be of the type integer, null given, called in [dirroot]/lib/form/filemanager.php on line 336
       
      More information about this error
       
      ×Debug info: 
      Error code: generalexceptionmessage
      ×Stack trace:
      line 767 of /lib/filelib.php: TypeError thrown
      line 336 of /lib/form/filemanager.php: call to file_get_all_files_in_draftarea()
      line 580 of /lib/formslib.php: call to MoodleQuickForm_filemanager->validateSubmitValue()
      line 526 of /lib/formslib.php: call to moodleform->validate_defined_fields()
      line 636 of /lib/formslib.php: call to moodleform->is_validated()
      line 156 of /course/edit.php: call to moodleform->get_data()
      

      Further Investigation

      This bug seems to be introduced by MDL-62849 and the root of this problem is the type declaration defined in function file_get_all_files_in_draftarea. In this definition, it is forced to receive $draftitemid as an int value but for this scenario, $draftitemid is null causing the exception to the user. Before the change on MDL-62849, the function that did this process was file_get_drafarea_files that does not have any type declaration.

        Attachments

          Activity

            People

            Assignee:
            guillalva06 Guillermo Leon Alvarez Salamanca
            Reporter:
            guillalva06 Guillermo Leon Alvarez Salamanca
            Peer reviewer:
            Adrian Greeve Adrian Greeve
            Integrator:
            Jun Pataleta Jun Pataleta
            Tester:
            Janelle Barcega Janelle Barcega
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            10 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Jul/18

                Time Tracking

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