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

Incorrect handling of quotes in SetValue processing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8
    • 1.8.7, 1.9.3
    • SCORM
    • None
    • MySQL
    • MOODLE_18_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

    Description

      When trying to set some string value containing quotes for such params like "cmi.interactions.n.learner_response", or
      "cmi.comments_from_learner.n.comment" , "cmi.suspend_data", some strange behaviour is shown:

      1. when string contains single quote (apostrophe) it gets unnecessary slashes before apostrophes stored in database
      changing line 259 in mod/scorm/locallib.php as follows seems to fix it
      $id = insert_record('scorm_scoes_track',$track, false);
      original code just makes double quoting

      2. when string contains double quote (") , this value can't be processed in JavaScript functions, calls to API just return npthing, and setted value is ignored, without even a failure result code. I suspect the reason is usage of eval in datamodels/scorm_1x.js.php, like that:

      if (element == 'cmi.comments')

      { eval(element+'+="'+value+'";'); }

      else

      { eval(element+'="'+value+'";'); }

      Attachments

        Issue Links

          Activity

            People

              piers Piers Harding
              dseverin Dmitry Severin
              Dan Marsden Dan Marsden
              Dan Marsden, Matteo Scaramuccia, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Oct/08