Skip to content

Commit afee79a

Browse files
james-johnston-thumbtackbarryvdh
authored andcommitted
Fix front-end crash when no twig collector exists (php-debugbar#312)
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.)
1 parent f7aa688 commit afee79a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DebugBar/Bridge/Twig/TwigCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getWidgets()
6868
'icon' => 'leaf',
6969
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
7070
'map' => 'twig',
71-
'default' => '[]'
71+
'default' => json_encode(array('templates' => array())),
7272
),
7373
'twig:badge' => array(
7474
'map' => 'twig.nb_templates',

0 commit comments

Comments
 (0)