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: Open
    • Minor
    • Resolution: Unresolved
    • 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)
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: