bug #19114 [HttpKernel] Dont close the reponse stream in debug (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] Dont close the reponse stream in debug

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19078
| License       | MIT
| Doc PR        | -

Because it's `terminate`'s job to clean the state, not the `Response`'s,
and because the current behavior prevents getting any output on trailing errors on FPM especially.

Commits
-------

2fbc200 [HttpKernel] Dont close the output stream in debug
This commit is contained in:
Fabien Potencier 2016-06-20 13:19:36 +02:00
commit a0cdcb0ffb
2 changed files with 8 additions and 6 deletions

View File

@ -373,12 +373,6 @@ class Response
$this->sendHeaders();
$this->sendContent();
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} elseif ('cli' !== PHP_SAPI) {
static::closeOutputBuffers(0, true);
}
return $this;
}

View File

@ -149,6 +149,14 @@ abstract class Kernel implements KernelInterface, TerminableInterface
}
if ($this->getHttpKernel() instanceof TerminableInterface) {
if (!$this->debug) {
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} elseif ('cli' !== PHP_SAPI) {
Response::closeOutputBuffers(0, true);
}
}
$this->getHttpKernel()->terminate($request, $response);
}
}