bug #14609 [DebugBundle] Remove inlined dumps on XHR (nicolas-grekas)

This PR was merged into the 2.6 branch.

Discussion
----------

[DebugBundle] Remove inlined dumps on XHR

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

Commits
-------

d0eb208 [DebugBundle] Remove inlined dumps on XHR
This commit is contained in:
Nicolas Grekas 2015-05-13 09:25:21 +02:00
commit 18eef21118
1 changed files with 3 additions and 3 deletions

View File

@ -135,13 +135,13 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) {
// Sub-requests and programmatic calls stay in the collected profile.
if (($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
return;
}
// In all conditions that remove the web debug toolbar, dumps are written on the output.
// In all other conditions that remove the web debug toolbar, dumps are written on the output.
if (!$this->requestStack
|| $request->isXmlHttpRequest()
|| !$response->headers->has('X-Debug-Token')
|| $response->isRedirection()
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))