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

Incorrect RegEx format test

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.8.3
    • Fix Version/s: 1.8.7, 1.9.3
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      JavaScript 1.5
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      In \mod\moodle\scorm\datamodels\scorm_12.js.php on line 20:

      CMIString4096 = '^.

      {0,4096}$';

      This was formerly:
      CMIString4096 = '^\.{0,4095}$';

      (Note: A dot in a character class only matches a literal dot, if it was intended as 'any character except newline' then the \r becomes redundant)

      This is used on line 288 for:

      matches = value.match(expression);

      ...to check the validity of SCORM data model expressions, in this case "cmi.comments"


      From the SCORM 1.2 Run-time Environment document:

      "CMIString4096 = A Set of ASCII characters with a maximum length of 4096 characters"


      I would like to suggest the following replacement regular expression so that the standard can be adhered to correctly:

      CMIString4096 = "^\\u0000-\\u00ff{0,4096}

      $";

      A similar adjustment is also applicable to CMIString256.

        Attachments

          Activity

            People

            • Assignee:
              piers Piers Harding
              Reporter:
              pinkduck Peter Chamberlin
              Tester:
              Dan Marsden
              Participants:
              Component watchers:
              Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Mihail Geshoski, Peter Dias
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Oct/08