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:
commit
18eef21118
|
@ -135,13 +135,13 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||||
|
|
||||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
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;
|
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
|
if (!$this->requestStack
|
||||||
|| $request->isXmlHttpRequest()
|
|
||||||
|| !$response->headers->has('X-Debug-Token')
|
|| !$response->headers->has('X-Debug-Token')
|
||||||
|| $response->isRedirection()
|
|| $response->isRedirection()
|
||||||
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|
||||||
|
|
Reference in New Issue