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:

      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

            • 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