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

SCORM convert php eval() to use EvalMath Class

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 2.8.7, 2.9.1
    • SCORM
    • MOODLE_28_STABLE, MOODLE_29_STABLE

      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 ')

            Unassigned Unassigned
            danmarsden Dan Marsden
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.