Description
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:
- Symfony\Component\Debug\ErrorHandler:handleException
call_user_func($this->exceptionHandler, $exception) L:546 - Symfony\Component\Debug\ExceptionHandler:handle
$this->sendPhpResponse($exception); L:121 - Symfony\Component\Debug\ExceptionHandler:sendPhpResponse
header('Content-Type: text/html; charset='.$this->charset); L:173 - which sends me header of content type first time. - Symfony\Component\Debug\ExceptionHandler:handle (continue)
call_user_func($this->handler, $exception); L:144 - Symfony\Component\HttpKernel\HttpKernel:terminateWithException
$response->sendHeaders(); L:104 - 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.