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

workaround_max_input_vars() not working well with array query params

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Do
    • 2.7.2
    • None
    • Libraries
    • MOODLE_27_STABLE

    Description

      To reproduce:

      <?php
       
      // Put this script into the $CFG->dirroot of your Moodle and visit it from the
      // browser.
       
      require(__DIR__.'/config.php');
      require_login();
       
      if (!empty($_REQUEST)) {
          header('Content-type: text/plain');
          var_dump($_REQUEST);
          die();
      }
       
      echo('<html><body>');
      echo('<form action="" method="post">');
      echo PHP_EOL;
      for ($i = 0; $i < 1100; $i++) {
          echo('<input type="hidden" name="foo[]" value="'.$i.'" />');
          echo PHP_EOL;
      }
      echo('<button type="submit">Submit</button>');
      echo('</body></html>');
      

      Assuming you have max_input_vars set to the default 1000, you should see that the $_REQUEST now contains invalid values and some vars are duplicated.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mudrd8mz David Mudrák (@mudrd8mz)
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: