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

Marking Guide Short name length not validated

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create an assignment with the setting 'Grading method' set to 'Marking guide'.
      2. Visit the assignment and click on 'Advanced grading' > 'Define marking guide'.
      3. Enter a long value in the 'Name' field and ensure you do not get a DB error when you submit.
      4. Edit the marking guide and using your browser's DOM editor, remove the 'maxlength' field from the 'Name' field.
      5. Add a very long value to the 'Name' field and click submit.
      6. Confirm you get the error 'You must enter not more than 255 characters here.' (It has been noted this error message has grammatically errors).
      7. Turn javascript off in your browser and remove maxlength and submit another long name
      8. Confirm you get the error 'You must enter not more than 255 characters here.' (It has been noted this error message has grammatically errors).
      9. Edit the marking guide again and this time enter a very long criterion name (next to the 'Marking guide' label) and ensure you get the error 'Criterion name must be less than 256 characters'.
      Show
      Create an assignment with the setting 'Grading method' set to 'Marking guide'. Visit the assignment and click on 'Advanced grading' > 'Define marking guide'. Enter a long value in the 'Name' field and ensure you do not get a DB error when you submit. Edit the marking guide and using your browser's DOM editor, remove the 'maxlength' field from the 'Name' field. Add a very long value to the 'Name' field and click submit. Confirm you get the error 'You must enter not more than 255 characters here.' (It has been noted this error message has grammatically errors). Turn javascript off in your browser and remove maxlength and submit another long name Confirm you get the error 'You must enter not more than 255 characters here.' (It has been noted this error message has grammatically errors). Edit the marking guide again and this time enter a very long criterion name (next to the 'Marking guide' label) and ensure you get the error 'Criterion name must be less than 256 characters'.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-48215_master

      Description

      If you create a marking guide, the length of shortname for each criterion is not validated before it is (attempted) inserted or updated in the database.

      This causes a DMLException when you attempt to save the guide.

      To test:

      1. Create a new assignment
      2. Create a new Marking guide
      3. Paste more than 255 characters in to the "Criterion name" field
      4. Set a max mark
      5. Save the guide and make ready.
      6. Should throw a DML exception

      DML should be something along the lines of:

      Default exception handler: Error writing to database Debug: Data too long for column 'shortname' at row 1
      UPDATE mdl_gradingform_guide_criteria SET shortname = ? WHERE id=?\
      [array (
        0 => 'Your CA asked you to  1 - consider the bases for trade (e.g., differences in technology, relative factor abundance, scale economies and product differentiation, etc.) between your country and other nations; 2 - take into account potential (as yet unrealised) trade that is prevented by the trade policies that have been imposed by the country\\'s government; and 3 - summarise the economic/political conditions in the country and the stance that it is likely to take at the multilateral negotiations.  Maximum 4 pages in length.  I have marked your submission according to these criteria:',
        1 => 777,
      )]
      Error code: dmlwriteexception
      * line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
      * line 1186 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      * line 1218 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
      * line 187 of /grade/grading/form/guide/lib.php: call to mysqli_native_moodle_database->update_record()
      * line 104 of /grade/grading/form/guide/lib.php: call to gradingform_guide_controller->update_or_check_guide()
      * line 56 of /grade/grading/form/guide/edit.php: call to gradingform_guide_controller->update_definition()
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mhughes2k Michael Hughes
              Reporter:
              mhughes2k Michael Hughes
              Peer reviewer:
              Mark Nelson
              Integrator:
              David Monllaó
              Tester:
              John Okely
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/15