bug #15763 [HttpKernel] fix DumpDataCollector compat with Twig 2.0 (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] fix DumpDataCollector compat with Twig 2.0

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15653
| License       | MIT
| Doc PR        | -

See https://github.com/twigphp/Twig/pull/1813

Commits
-------

92e50a3 [HttpKernel] fix DumpDataCollector compat with Twig 2.0
This commit is contained in:
Fabien Potencier 2015-09-11 15:10:24 +02:00
commit bee5c61093

View File

@ -98,9 +98,9 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
} elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof \Twig_Template) {
$info = $trace[$i]['object'];
$name = $info->getTemplateName();
$src = $info->getEnvironment()->getLoader()->getSource($name);
$src = method_exists($info, 'getSource') ? $info->getSource() : $info->getEnvironment()->getLoader()->getSource($name);
$info = $info->getDebugInfo();
if (isset($info[$trace[$i - 1]['line']])) {
if (null !== $src && isset($info[$trace[$i - 1]['line']])) {
$file = false;
$line = $info[$trace[$i - 1]['line']];
$src = explode("\n", $src);