Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Symfony duplicates content-type header #21204

Copy link
Copy link
Closed
@rommeras

Description

@rommeras
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.1.8

I use php 7.0.0 with symfony 3.1.8. The issue is when I got errors from php - symfony doesn't return me stack trace, all I can see is "Internal Server Error" page. In logs of apache I found FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.0.0.fcgi" aborted: error parsing headers: duplicate header 'Content-Type'
I started debugging, and that's what I found. I use php scalar type hinting, so when the wrong type comes as argument, php returns TypeError, symfony catches it, and then step by step:

  1. Symfony\Component\Debug\ErrorHandler:handleException
    call_user_func($this->exceptionHandler, $exception) L:546
  2. Symfony\Component\Debug\ExceptionHandler:handle
    $this->sendPhpResponse($exception); L:121
  3. Symfony\Component\Debug\ExceptionHandler:sendPhpResponse
    header('Content-Type: text/html; charset='.$this->charset); L:173 - which sends me header of content type first time.
  4. Symfony\Component\Debug\ExceptionHandler:handle (continue)
    call_user_func($this->handler, $exception); L:144
  5. Symfony\Component\HttpKernel\HttpKernel:terminateWithException
    $response->sendHeaders(); L:104
  6. Symfony\Component\HttpFoundation\Response:sendHeaders
    header($name.': '.$value, false, $this->statusCode); L:339 - which sends me header of content type second time.

The output of headers_list function:
0 = "X-Powered-By: PHP/7.0.0"
1 = "Content-Type: text/html; charset=UTF-8"
2 = "Cache-Control: no-cache"
3 = "X-Debug-Token: 242fbb"
4 = "X-Debug-Token-Link: http://pr.project/app_dev.php/_profiler/242fbb"
5 = "Content-Type: text/html; charset=UTF-8"
6 = "Date: Sun, 08 Jan 2017 18:45:04 GMT"

Which causes error of duplicating headers.
Please fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.