Skip to content

Commit

Permalink
bug #25824 Fixing a bug where the dump() function depended on bundle …
Browse files Browse the repository at this point in the history
…ordering (weaverryan)

This PR was merged into the 2.7 branch.

Discussion
----------

Fixing a bug where the dump() function depended on bundle ordering

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | not needed

If DebugBundle is registered *before* TwigBundle, then the simpler `dump()` function wins over the fancy, var-dumper one from DebugBundle. In other words, you get different functionality based on the *order* in which you install libraries. To get the "bad" way, you can:

```
composer create-project symfony/skeleton show_bad_dump
cd show_bad_dump
composer require symfony/debug-bundle
composer require twig
```

Then create a Twig template with a `dump()` inside. It will use the less-fancy XDebug version.

I'm not sure if there's a more elegant fix for this or not... I have verified locally that this DOES fix the issue.

Thanks!

Commits
-------

717663a Fixing a bug where the dump() function depended on bundle ordering
  • Loading branch information
fabpot committed Jan 17, 2018
2 parents 132cec4 + 717663a commit 3a8f905
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -85,7 +85,11 @@ public function process(ContainerBuilder $container)

if ($container->getParameter('kernel.debug')) {
$container->getDefinition('twig.extension.profiler')->addTag('twig.extension');
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');

// only register if the improved version from DebugBundle is *not* present
if (!$container->has('twig.extension.dump')) {
$container->getDefinition('twig.extension.debug')->addTag('twig.extension');
}
}

$twigLoader = $container->getDefinition('twig.loader.native_filesystem');
Expand Down

0 comments on commit 3a8f905

Please sign in to comment.