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

FileManager Exception when editing course settings

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.4.4, 3.5.1, 3.6
    • 3.4.4, 3.5.1, 3.6
    • Filepicker
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • MDL-63231-set-default-value-for-int-param-MOODLE_Master
    • 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.

      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.

            guillalva06 Guillermo Leon Alvarez Salamanca
            guillalva06 Guillermo Leon Alvarez Salamanca
            Adrian Greeve Adrian Greeve
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            10 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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