When I updated from Symfony 3.4 to 4 and displayed it in the browser, the following error is displayed on the toolbar, and the toolbar is not working properly.
Of course, I haven't changed the code myself. I hope someone can help me. Please let me know if you have any missing information.
Error message
//toolbar
An error occurred while loading the web debug toolbar.
Open the web profiler.
//web profiler
Argument 1 passed to SymfonyComponentStopwatchStopwatch::stopSection() must be of the type string, null given,
called in /home/Symfony/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php on line 69
Stopwatch.php
/**
* Starts an event.
*
* @param string $name The event name
* @param string $category The event category
*
* @return StopwatchEvent A StopwatchEvent instance
*/
public function start($name, $category = null)
{
return end($this->activeSections)->startEvent($name, $category);
}
TraceableEventDispatcher.php
/**
* Constructor.
*
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
* @param Stopwatch $stopwatch A Stopwatch instance
* @param LoggerInterface $logger A LoggerInterface instance
*/
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null)
{
$this->dispatcher = $dispatcher;
$this->stopwatch = $stopwatch;
$this->logger = $logger;
$this->called = array();
$this->wrappedListeners = array();
$this->firstCalledEvent = array();
}
/**
* Sets the profiler.
*
* @param Profiler|null $profiler A Profiler instance
*/
public function setProfiler(Profiler $profiler = null)
{
$this->profiler = $profiler;
}
Version
Symfony4.0
symfony/stopwatch (v5.2.1)
question from:
https://stackoverflow.com/questions/65895283/symfony-error-argument-1-passed-to-symfony-component-stopwatch-stopwatchstops 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…