diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 8352481dbb56..0327a46f7170 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -135,13 +135,13 @@ public function dump(Data $data) 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'))