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

Comments throw exception that aren't caught

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.6.6
    • Fix Version/s: None
    • Component/s: Assignment, Comments
    • Labels:
      None
    • Affected Branches:
      MOODLE_26_STABLE

      Description

      If a submission comment throws an exception it breaks the entire assignment submission page as the exception is never caught.

      Default exception handler: You can't add comments Debug: 
      Error code: nopermissiontocomment
      * line 61 of /mod/assign/submission/comments/lib.php: comment_exception thrown
      * line ? of unknownfile: call to assignsubmission_comments_comment_validate()
      * line 7382 of /lib/moodlelib.php: call to call_user_func_array()
      * line 7364 of /lib/moodlelib.php: call to component_callback()
      * line 828 of /comment/lib.php: call to plugin_callback()
      * line 839 of /comment/lib.php: call to comment->validate()
      * line 415 of /comment/lib.php: call to comment->can_view()
      * line 74 of /mod/assign/submission/comments/locallib.php: call to comment->output()
      * line 894 of /mod/assign/renderer.php: call to assign_submission_comments->view_summary()
      * line 221 of /lib/outputrenderers.php: call to mod_assign_renderer->render_assign_submission_plugin_submission()
      * line 665 of /mod/assign/renderer.php: call to plugin_renderer_base->render()
      * line 221 of /lib/outputrenderers.php: call to mod_assign_renderer->render_assign_submission_status()
      * line 3656 of /mod/assign/locallib.php: call to plugin_renderer_base->render()
      * line 3941 of /mod/assign/locallib.php: call to assign->view_student_summary()
      * line 525 of /mod/assign/locallib.php: call to assign->view_submission_page()
      * line 53 of /mod/assign/view.php: call to assign->view()
      

      What appears to happen is that the renderer is attempting to display a submission comment but the validation code throws exception when it is called in the can_view()) function (in /comment/lib.php).

      The can_vew() function should (in my view) should return false on the basis of an exception, as any exception really means that they can't view the item.

      The "broad" fix for it not breaking the mod_Assign module would be to wrap the function view_summary() in /mod/assign/submission/comments/locallib.php with a try {} catch{}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mhughes2k Michael Hughes
                Participants:
                Component watchers:
                Damyon Wiese, Adrian Greeve, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: