diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 2748910a19ae..cada4ee6ca43 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -91,6 +91,10 @@ public function panelAction(Request $request, $token) $panel = $request->query->get('panel', 'request'); $page = $request->query->get('page', 'home'); + if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) { + $token = $latest['token']; + } + if (!$profile = $this->profiler->loadProfile($token)) { return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html')); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig index aeffb2cf256b..9be617a3ecab 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig @@ -25,10 +25,17 @@ The token already exists in the database.
{% elseif about == 'no_token' %} -- Token "{{ token }}" was not found in the database. -
+ {% if token == 'latest' %} ++ No profiles found in the database. +
+ {% else %} ++ Token "{{ token }}" was not found in the database. +
+ {% endif %} {% endif %} {% endblock %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index 12728b964df0..6df82890c180 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -14,6 +14,7 @@ {% if profile %}