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

Incorrect RegEx format test

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8, 1.8.1, 1.8.2, 1.8.3
    • 1.8.7, 1.9.3
    • SCORM
    • None
    • JavaScript 1.5
    • MySQL
    • MOODLE_18_STABLE
    • 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

            piers Piers Harding
            pinkduck Peter Chamberlin
            Dan Marsden Dan Marsden
            Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/Oct/08