Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5800

Import report does not check length of string in xml file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.7.8
    • Fix Version/s: None
    • Labels:
      None
    • Plugin Version:
      2011040115
    • Affected Branches:
      MOODLE_27_STABLE

      Description

      importing and exporting a report can cause the import to throw a dml exception because the name of the report is appended with the current date and time which allows the name field to exceed the 128 var chars as defined in the database.

      Some validation or a warning stating the data in the import field will be concatenated, this would be ok for the name field but not for the sql definition

      Steps to replicate:

      Create a report whose name is 97 chars in length
      Export the report
      Import the same report
      The name gets appended with (Current Day, Date Month Year, hour:minutes AM/PM)
      Error thrown dmlexception inserting name into data base exceeds column width

      Cause:
      Current Day 6 to 9 characters
      Date 2 characters
      Month 3 to 9 chars
      Year 4 chars
      Hour 2 chars
      Minutes 2 chars
      am/pm 2 chars
      Miscellaneous (), + spaces = 8

      Total minimum 29 Maximum 38

      97 + 38 = 135 (dmlexception) or 29 + 97 = 126 (no dml exception)

      Since this is read directly from the xml file the name of the file will have no consequence in this scenario.

      Resolution:
      Open editable window of the offending column to edit the string then write back to the import file and re-import

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: