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

"Too many params passed to js_call_amd" notice should say what it means

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4, 3.5.3
    • 3.5.4
    • Libraries
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_35_STABLE
    • Hide

      Ensure that Debugging is set to Developer level.

      Hack some code so that it calls js_call_amd with lots of arguments. (You can do this be installing qtype_coderunner, then creating a question with an 'Answer box preload' longer than 1 Kb, then previewing that question.

      Verify that the debug message is accurate.

      Show
      Ensure that Debugging is set to Developer level. Hack some code so that it calls js_call_amd with lots of arguments. (You can do this be installing qtype_coderunner, then creating a question with an 'Answer box preload' longer than 1 Kb, then previewing that question. Verify that the debug message is accurate.

    Description

      As a developer (of the CodeRunner question type) I am finding the following code in lib/outputrequirementslib.php a bit troublesome:

      {{ if ($CFG->debugdeveloper) {}}
          $toomanyparamslimit = 1024;
          if (strlen($strparams) > $toomanyparamslimit) {
              debugging('Too many params passed to js_call_amd("' . $fullmodule . '", "' . $func . '")',       DEBUG_DEVELOPER);
      {{    }}}
      {{ }}}

      Is there a good reason for this check?  The error message itself is confusing as it's not the number of parameters that's the issue, but the lengths of the JSON-encoded parameter list. I am passing an array of selected language strings to my AMD modules and often triggering this error. Since it only affects developers, it's not a major problem and I've simply commented it out but I would like to know if there is a potential problem with passing an array of strings to AMD modules.

       

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              trampgeek Richard Lobb
              David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
              David Monllaó David Monllaó
              Janelle Barcega Janelle Barcega
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Jan/19

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h