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

SCORM convert php eval() to use EvalMath Class

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.8.7, 2.9.1
    • Fix Version/s: None
    • Component/s: SCORM
    • Labels:
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE

      Description

      The function scorm_eval_prerequisites() uses the evil PHP eval() function. We should convert that to using the evalMath() class already included in Moodle which performs a similar task without being "evil"

      the problematic code:
      return eval('return '.implode($stack).';');

      Most packages I have only have a single prereq item so $stack only contains a single item with the string ' true ' or ' false ' and in this case all that is really needed is:

      return $element;

      instead of that other crap.

      but... if there are multiple items $stack would contain something like this: (I don't have any packages to test this)

      Array
      (
      [0] => false
      [1] => true
      )
      (the code puts 2 spaces before and after each value in the array (' false ', ' true ')

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                danmarsden Dan Marsden
                Participants:
                Component watchers:
                Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: