Moodle
  1. Moodle
  2. MDL-18051

Quiz regrade gives error with debugging set to max

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.6
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      I just regraded a quiz, which uses only short answer an multiple choice questions. I had previously altered the overall feedback settings, but nothing else. I got the following error loads of times at the bottom of the screen, after all the regradings had happened. It went OK it seems other than that.

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

      Notice: Undefined offset: -2 in E:\Moodle_webserver\moodle\lib\evalmath\evalmath.class.php on line 425

        Gliffy Diagrams

          Activity

          Hide
          Sam Marshall added a comment -

          We are seeing the same thing here. It appears to be caused by an error in the evalmath class which is used for calculated grades.

          To reproduce:

          error_reporting(E_ALL);
          $silly = new EvalMath();
          $silly->nfx('(gi6-20+1)/(2*(gi6-20+0.5))');

          The actual results of the function appear to be correct, so this warning does not do any harm, but it is rather disturbing.

          Show
          Sam Marshall added a comment - We are seeing the same thing here. It appears to be caused by an error in the evalmath class which is used for calculated grades. To reproduce: error_reporting(E_ALL); $silly = new EvalMath(); $silly->nfx('(gi6-20+1)/(2*(gi6-20+0.5))'); The actual results of the function appear to be correct, so this warning does not do any harm, but it is rather disturbing.
          Hide
          Sam Marshall added a comment -

          OK, I found it. The bug is:

          • When you close a bracket, it looks at the token before the open-bracket (on its stack) to see if it is a function call.
          • It does this even if there is no token before the open-bracket
          • So you will get this warning for each bracket in the expression that isn't a function call.

          Will fix shortly.

          Show
          Sam Marshall added a comment - OK, I found it. The bug is: When you close a bracket, it looks at the token before the open-bracket (on its stack) to see if it is a function call. It does this even if there is no token before the open-bracket So you will get this warning for each bracket in the expression that isn't a function call. Will fix shortly.
          Hide
          Petr Skoda added a comment -

          thanks!

          Show
          Petr Skoda added a comment - thanks!
          Hide
          Sam Marshall added a comment -

          This is also reproducible with the expression (1+1)

          I changed the logic for the last() function involved here so that instead of giving a debugging warning if you ask for something off the end of the stack, it returns null. This is analogous to the pop() function.

          While this basically just gets rid of the warning without fixing anything I did verify that the warning was harmless - the postfix version of the expression is correct.

          Show
          Sam Marshall added a comment - This is also reproducible with the expression (1+1) I changed the logic for the last() function involved here so that instead of giving a debugging warning if you ask for something off the end of the stack, it returns null. This is analogous to the pop() function. While this basically just gets rid of the warning without fixing anything I did verify that the warning was harmless - the postfix version of the expression is correct.
          Hide
          Sam Hemelryk added a comment -

          Confirmed, no error message shown. Thanks

          Show
          Sam Hemelryk added a comment - Confirmed, no error message shown. Thanks

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: