title: Symfony request object has wrong attributes (especially `$request->header->get( 'accept' )`)
body: <p>In my controller function I need to return different replies based on the accepted content type and how the request was made. But for some reason <code>$request-&gt;header-&gt;get( 'accept' )</code> or <code>$request-&gt;getRequestFormat()</code> always returns HTML (or "text/html" respectively) although the browser has sent something different according to Firebug and Wireshark also confirms that the original request was really different.</p>
  
  <p>Basically my code looks like this:</p>
  
  <pre><code>public function someControllerAction() {
    $request = $this-&gt;getRequest();
  
    if( $request-&gt;isXmlHttpRequest() &amp;&amp; $request-&gt;getRequestFormat() == 'html' ) {
      // (1) Return some HTML fragment that is used to update the DOM at client side
    } else if( $request-&gt;isXmlHttpRequest() &amp;&amp; $request-&gt;getRequestFormat() == 'json' ) {
      // (2) Return a JSON object
    } else if( $request-&gt;getRequestFormat() == 'html' ) {
      // (3) Return a full HTML page from a TWIG template
    }
  
    // In all other cases, return a 406 error
  }
  </code></pre>
  
  <p>For some reason, only case (1) or case (3) are executed, because the requested format always equals HTML. I have already tried</p>
  
  <pre><code>die( var_dump( $request-&gt;header ) )
  </code></pre>
  
  <p>to have a look at what Symfony thinks the header was and I noticed some other minor changes in the header compared to what Wireshark tells. For example,everything is converted to lowercase.</p>
  
  <p>At the moment my best guess is that somewhere in the depth of the Symfony core some kind of normalization seems to occur which also replaces the Accept-Header-Field by a default "text/html". Interestingly, the X-Requested-With-Field is not normalized away but survives.</p>
  
  <p>What do I have to change that the request object returns the actual (true) header fields?</p>
  
  <p><strong>UPDATE:</strong> The result of</p>
  
  <pre><code>die( var_dump( getallheaders() ) );
  </code></pre>
  
  <p>shows the wrong header, too. Does Symfony manipulate the native PHP variables or does this indicate that Apache twiddles with the accept header before passing it to the PHP handler?</p>