Skip to content

Commit

Permalink
Fix front-end crash when no twig collector exists (#312)
Browse files Browse the repository at this point in the history
If the twig collector wasn’t used on a particular request, the twig
widget crashes the client.  Fix the bug by assuming a default array of
zero templates.

(For example, an AJAX call that didn’t construct a TwigCollector would
trigger this crash.)
  • Loading branch information
james-johnston-thumbtack authored and barryvdh committed Jan 5, 2017
1 parent f7aa688 commit afee79a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DebugBar/Bridge/Twig/TwigCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getWidgets()
'icon' => 'leaf',
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
'map' => 'twig',
'default' => '[]'
'default' => json_encode(array('templates' => array())),
),
'twig:badge' => array(
'map' => 'twig.nb_templates',
Expand Down

0 comments on commit afee79a

Please sign in to comment.