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

Bad argument passed to core_renderer::user_picture() in mod_assign renderer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 3.5.5, 3.6.3
    • 3.5.3, 3.6.2, 3.7
    • Assignment
    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • MDL-63975-master
    • Hide

      1. Enable debugging

      2. Create an assignment allowing multiple attempts in a course with a teacher and a student
      3. As the student add a submission to the an assignment

      4. As the teacher, allow another attempt for the assignment without grading or giving feedback.
      5. As the student go back to the assignment

      6. Verify you don't see any debugging message

      Show
      1. Enable debugging 2. Create an assignment allowing multiple attempts in a course with a teacher and a student 3. As the student add a submission to the an assignment 4. As the teacher, allow another attempt for the assignment without grading or giving feedback. 5. As the student go back to the assignment 6. Verify you don't see any debugging message

    Description

      Environment:

      Moodle 3.5.2+ (Build: 20181031)
      mod_assign 2018051400
      mariadb 5.5.56 2
      php 7.1.2
      CentOS Linux release 7.5.1804
      Apache / 2.4.6

      Reproduction of the error:
      1. the teacher creates an assignment via mod_assign
      2. The student submits an assignment and validates it for evaluation
      3. The teacher authorizes a new attempt for the student WITHOUT having noted it on his first attempt
      4. the student tries to go back to the assignement, the error appears

      Fault:
      Exception: Argument 1 passed to core_renderer :: user_picture () must be an instance of stdClass, string given, called in [dirroot] /mod/assign/renderer.php on line 1106.

      Code causing the error:

      In [dirroot] /mod/assign/renderer.php on line +/- 1106:

      $ cell2 = new html_table_cell ($ this-> output-> user_picture ($ grade-> grader).
      $ this-> output-> spacer (array ('width' => 30)). fullname ($ grade-> grader));

      Assumption:
      $ grade-> grader is null, empty or different from what is expected because the previous assignment was not rated then there is no grader

      Patch:
      Removing the call to user_picture makes the problem no longer appears. It's a dirty patch because I'm not able to measure the other implications of the problem:

      In [dirroot] /mod/assign/renderer.php on line +/- 1106:

       

      // Graded by.
      $ cell1 = new html_table_cell ($ gradedbystr);
      // $ cell2 = new html_table_cell ($ this-> output-> user_picture ($ grade-> grader).
      // $ this-> output-> spacer (array ('width' => 30)). fullname ($ grade-> grader));
      // Nicolas 12/11/18: patch to work around a programming error
      $ cell2 = new html_table_cell ($ this-> output-> spacer (array ('width' => 30)). fullname ($ grade-> grader));
      

       

       

       

      Attachments

        Issue Links

          Activity

            People

              damyon Damyon Wiese
              n.mouillet@helmo.be Nicolas Mouillet
              Eric Merrill Eric Merrill
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Janelle Barcega Janelle Barcega
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Mar/19

                Time Tracking

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