Skip to content

[DebugBundle] Always collect dumps #14627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public function dump(Data $data)

if ($this->dumper) {
$this->doDump($data, $name, $file, $line);
} else {
$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount;
}

$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount;

if ($this->stopwatch) {
$this->stopwatch->stop('dump');
}
Expand All @@ -136,7 +136,7 @@ public function dump(Data $data)
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// Sub-requests and programmatic calls stay in the collected profile.
if (($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
return;
}

Expand All @@ -154,13 +154,9 @@ public function collect(Request $request, Response $response, \Exception $except
$this->dumper = new CliDumper('php://output', $this->charset);
}

foreach ($this->data as $i => $dump) {
$this->data[$i] = null;
foreach ($this->data as $dump) {
$this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
}

$this->data = array();
$this->dataCount = 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function testCollectDefault()
$output = ob_get_clean();

$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
$this->assertSame(1, $collector->getDumpsCount());
}

public function testCollectHtml()
Expand Down Expand Up @@ -99,6 +100,7 @@ public function testCollectHtml()
$output = preg_replace('/sf-dump-\d+/', 'sf-dump', $output);

$this->assertSame($xOutput, $output);
$this->assertSame(1, $collector->getDumpsCount());
}

public function testFlush()
Expand Down