title: Symfony 5: incorrectly returned page content
body: <p>after multiple research I come to ask for your help.</p>
  <p>I created several pages in my symfony project, this my controller code:</p>
  <pre><code>public function liste(Request $request){
      $users = $this-&gt;getDoctrine()
      -&gt;getRepository(VicidialUsers::class)
      -&gt;findAll();
  
      return $this-&gt;render('user/list_users.html.twig', array(
          'users' =&gt; $users
      ));
  }
  
  public function nouveau(Request $request): Response
  {
      $user = new VicidialUsers();
      $form = $this-&gt;createForm(VicidialUsersType::class , $user);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($user);
          $em-&gt;flush();
          $this-&gt;get('session')-&gt;getFlashBag()
              -&gt;add('notice', 'L\'utilisateur à été bien ajouter');
          //clear form values after successful form submission
          unset($user);
          unset($form);
          $user = new VicidialUsers();
          $form = $this-&gt;createForm(VicidialUsersType::class , $user);
      }
  
      return $this-&gt;render('user/adduser.html.twig', array(
          'form' =&gt; $form-&gt;createView()
      ));
  }
  
  public function edit(Request $request , $userId){
  
      $user = new VicidialUsers();
      $user = $this-&gt;getDoctrine()-&gt;getRepository
      (VicidialUsers::class)-&gt;find($userId);
      $form = $this-&gt;createForm(VicidialUsersType::class , $user);
      $form-&gt;handleRequest($request);
  
      if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
          $em-&gt;persist($user);
          $em-&gt;flush();
          $this-&gt;get('session')-&gt;getFlashBag()
              -&gt;add('notice', 'L\'utilisateur a été bien modifier');
      }
  
      return $this-&gt;render('user/edituser.html.twig', array(
          'form' =&gt; $form-&gt;createView() ,'user' =&gt; $user
      ));
  }
  </code></pre>
  <p>Only problem the page returned incorrectly in the case of editing or adding a new user</p>
  <p>This is the user list display:
  127.0.0.1:8000/utilisateurs:</p>
  <p>[![User List][1]][1]</p>
  <p>in the case of edit: 127.0.0.1:8000/user/edit/3:</p>
  <p>the template  is returned incorrectly</p>
  <p>[![Edit User][2]][2]</p>
  <p>This is my template code for <code>adduser.html.twig</code></p>
  <pre><code>{% extends 'base.html.twig'%}
  
  {% block body %} 
  &lt;div class=&quot;container-fluid&quot;&gt;
      &lt;h1 class=&quot;h3 mb-4 text-gray-800&quot;&gt;Ajouter un nouvel utilisateur&lt;/h1&gt;
  &lt;/div&gt;
  &lt;div class=&quot;col-md-12&quot;&gt;
      {% for flashMessage in app.session.flashbag.get('notice') %}
      &lt;div class=&quot;alert alert-success alert-dismissable&quot;&gt;
          &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot; aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/button&gt;
          &lt;h4&gt;&lt;i class=&quot;icon fa fa-check&quot;&gt;&lt;/i&gt;{{ flashMessage }}&lt;/h4&gt;
      &lt;/div&gt;
      {% endfor %}
      &lt;!-- general form elements --&gt;
      
      &lt;div class=&quot;box box-primary&quot;&gt;
          &lt;!-- form start --&gt;
          &lt;form method=&quot;post&quot;&gt;
              &lt;div class=&quot;box-body&quot;&gt;
                  &lt;div class=&quot;row&quot;&gt;
                      &lt;div class=&quot;col-md-6&quot;&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.user) }}&lt;/label&gt;
                              {{ form_widget(form.user) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.user) }}&lt;/span&gt;
                              &lt;div id=&quot;notification&quot;&gt;&lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.pass) }}&lt;/label&gt;
                              {{ form_widget(form.pass) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.pass) }}&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.fullName) }}&lt;/label&gt;
                              {{ form_widget(form.fullName) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.fullName) }}&lt;/span&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;                             
                      &lt;div class=&quot;col-md-6&quot;&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.userLevel) }}&lt;/label&gt;
                              {{ form_widget(form.userLevel) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.userLevel) }}&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.userGroup) }}&lt;/label&gt;
                              {{ form_widget(form.userGroup) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.userGroup) }}&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.phoneLogin) }}&lt;/label&gt;
                              {{ form_widget(form.phoneLogin) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.phoneLogin) }}&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;form-group&quot;&gt;
                              &lt;label&gt;{{ form_label(form.phonePass) }}&lt;/label&gt;
                              {{ form_widget(form.phonePass) }}
                              &lt;span class=&quot;text-danger&quot;&gt;{{ form_errors(form.phonePass) }}&lt;/span&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;&lt;!-- /.box-body --&gt;
              {{ form_rest(form) }}
              &lt;div class=&quot;box-footer&quot;&gt;
                  &lt;input type=&quot;submit&quot; class=&quot;btn btn-primary&quot; value=&quot;Ajouter&quot; /&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  {% endblock %}
  
      
  
             
  </code></pre>
  <p>how can I solve this problem?</p>