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 e9a4a51b40..dd95b511b4 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
@@ -95,7 +95,11 @@
Execution timeline
- {% if collector.events is empty %}
+ {% if not collector.isStopwatchInstalled() %}
+
+
The Stopwatch component is not installed. If you want to see timing events, run: composer require symfony/stopwatch
.
+
+ {% elseif collector.events is empty %}
No timing events have been recorded. Are you sure that debugging is enabled in the kernel?
diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json
index c1efe11a26..241a5e350b 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/composer.json
+++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json
@@ -17,7 +17,7 @@
],
"require": {
"php": "^5.5.9|>=7.0.8",
- "symfony/http-kernel": "~3.3|~4.0",
+ "symfony/http-kernel": "~3.4.25|^4.2.6",
"symfony/polyfill-php70": "~1.0",
"symfony/routing": "~2.8|~3.0|~4.0",
"symfony/twig-bridge": "~2.8|~3.0|~4.0",
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
index 99149ab0be..f48db70568 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
@@ -47,6 +47,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
'token' => $response->headers->get('X-Debug-Token'),
'start_time' => $startTime * 1000,
'events' => [],
+ 'stopwatch_installed' => \class_exists(Stopwatch::class, false),
];
}
@@ -139,6 +140,14 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
return $this->data['start_time'];
}
+ /**
+ * @return bool whether or not the stopwatch component is installed
+ */
+ public function isStopwatchInstalled()
+ {
+ return $this->data['stopwatch_installed'];
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
index cf6a86695d..793fbd319f 100644
--- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
@@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector;
+use Symfony\Component\Stopwatch\Stopwatch;
/**
* @group time-sensitive
@@ -51,5 +52,6 @@ class TimeDataCollectorTest extends TestCase
$c->collect($request, new Response());
$this->assertEquals(123456000, $c->getStartTime());
+ $this->assertSame(\class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
}
}