From 3dd3d582c4adfd766802506dd156dc3f8c2bdeca Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Sun, 12 Feb 2012 10:02:50 +0100 Subject: [PATCH] [EventListener] Fix an issue with sub-requests --- .../Resources/views/Collector/time.html.twig | 4 ++-- .../Component/HttpKernel/EventListener/ProfilerListener.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig index b7aa90004b..6a97c900b5 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig @@ -66,7 +66,7 @@ - {{ collector.events.__section__.totaltime }} ms {% if profile.parent %} - - parent + - parent {% endif %} @@ -79,7 +79,7 @@ {% for child in profile.children %} {% set events = child.getcollector('time').events %}

- Sub-request "{{ child.getcollector('request').requestattributes.get('_controller') }}" + Sub-request "{{ child.getcollector('request').requestattributes.get('_controller') }}" - {{ events.__section__.totaltime }} ms

diff --git a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index c0f240a0ea..dbbb441889 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -102,7 +102,11 @@ class ProfilerListener implements EventSubscriberInterface // keep the profile as the child of its parent if (!$master) { array_pop($this->requests); - $this->children[end($this->requests)][] = $profile; + + $parent = end($this->requests); + $profiles = isset($this->children[$parent]) ? $this->children[$parent] : array(); + $profiles[] = $profile; + $this->children[$parent] = $profiles; } // store the profile and its children