1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-03-15 11:50:01 +01:00

Fix front-end crash when no twig collector exists (#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.)
This commit is contained in:
James Johnston 2017-01-05 03:46:19 -05:00 committed by Barry vd. Heuvel
parent f7aa6884c2
commit afee79a236

View File

@ -68,7 +68,7 @@ class TwigCollector extends DataCollector implements Renderable, AssetProvider
'icon' => 'leaf',
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
'map' => 'twig',
'default' => '[]'
'default' => json_encode(array('templates' => array())),
),
'twig:badge' => array(
'map' => 'twig.nb_templates',