Infinit loop when I submit a form and redirect to this form with an additionnal parameter I created a form. When the form is submitted, I want redirect to the form page and pass an additional parameter. 

I do this : 

public function buildForm(array $form, FormStateInterface $form_state, $results = null)
{
  if ($results) {
    customlog($results, "RESULTS !!!"); // write in a log file
  }
  $form['submit'] = [
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Submit'),
  ];
  return $form;
}

public function validateForm(array &amp;$form, FormStateInterface $form_state){}

public function submitForm(array &amp;$form, FormStateInterface $form_state) {
  $results = array();
  // do some work ...
  // ...
  // $results is a simple associative array
  customlog("I pass here !", __FUNCTION__); // write in a log file
  return \Drupal::formBuilder()-&gt;getForm('Drupal\mycustommodule\Form\MyCustomForm', $results);
}


My issue is when I submit this form, the page indefinitely load. When I check my log file, I realize that the "I pass here !" log is repeated indefinitely.

Where is my mistake ? When the form is submitted, how can I redirect to the same form with an additional parameter without this infinit loop ? 

Thank you :)
If you want to redirect to the form page you need to do something like this in your submit handler:

$form_state-&gt;setRedirect('NAME_OF_THE_ROUTE_OF_YOUR_FORM', $route_paramters, $options);


Maybe you can insert your results by query parameters?! Or save them in a session so that they can be used again. But the $form_state->setRebuild seems to be smarter to me.