Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d80589c

Browse filesBrowse files
committed
[Debug] Swap dumper services at bootstrap
This commit fix a bug when using debug function too soon. For example, if you call dump function during kernel::boot() the dump output will be sent to stderr, even in a web context. With this patch, the data collector is used by default, so the dump output is send to the WDT. In a CLI context, if dump is used too soon, the datacollector will buffer it, and release it at the end of the script. So in this case everything will be visible by the end used.
1 parent adb7033 commit d80589c
Copy full SHA for d80589c

File tree

Expand file treeCollapse file tree

4 files changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+6
-6
lines changed

‎src/Symfony/Bundle/DebugBundle/DebugBundle.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DebugBundle/DebugBundle.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function boot()
3030
// configuration for CLI mode is overridden in HTTP mode on
3131
// 'kernel.request' event
3232
VarDumper::setHandler(function ($var) use ($container) {
33-
$dumper = $container->get('var_dumper.cli_dumper');
33+
$dumper = $container->get('data_collector.dump');
3434
$cloner = $container->get('var_dumper.cloner');
3535
$handler = function ($var) use ($dumper, $cloner) {
3636
$dumper->dump($cloner->cloneVar($var));

‎src/Symfony/Bundle/DebugBundle/Resources/config/services.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DebugBundle/Resources/config/services.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<service id="debug.dump_listener" class="Symfony\Component\HttpKernel\EventListener\DumpListener">
2323
<tag name="kernel.event_subscriber" />
2424
<argument type="service" id="var_dumper.cloner" />
25-
<argument type="service" id="data_collector.dump" />
25+
<argument type="service" id="var_dumper.cli_dumper" />
2626
</service>
2727

2828
<service id="var_dumper.cloner" class="Symfony\Component\VarDumper\Cloner\VarCloner" />

‎src/Symfony/Component/HttpKernel/EventListener/DumpListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/DumpListener.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\HttpKernel\EventListener;
1313

14+
use Symfony\Component\Console\ConsoleEvents;
1415
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15-
use Symfony\Component\HttpKernel\KernelEvents;
1616
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
1717
use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
1818
use Symfony\Component\VarDumper\VarDumper;
@@ -50,6 +50,6 @@ public function configure()
5050
public static function getSubscribedEvents()
5151
{
5252
// Register early to have a working dump() as early as possible
53-
return array(KernelEvents::REQUEST => array('configure', 1024));
53+
return array(ConsoleEvents::COMMAND => array('configure', 1024));
5454
}
5555
}

‎src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\HttpKernel\Tests\EventListener;
1313

14+
use Symfony\Component\Console\ConsoleEvents;
1415
use Symfony\Component\HttpKernel\EventListener\DumpListener;
15-
use Symfony\Component\HttpKernel\KernelEvents;
1616
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
1717
use Symfony\Component\VarDumper\Cloner\Data;
1818
use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
@@ -28,7 +28,7 @@ class DumpListenerTest extends \PHPUnit_Framework_TestCase
2828
public function testSubscribedEvents()
2929
{
3030
$this->assertSame(
31-
array(KernelEvents::REQUEST => array('configure', 1024)),
31+
array(ConsoleEvents::COMMAND => array('configure', 1024)),
3232
DumpListener::getSubscribedEvents()
3333
);
3434
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.