Symfony error: Argument 1 passed to Symfony\Component\Stopwatch\Stopwatch::stopSection()

655 views Asked by At

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 Symfony\Component\Stopwatch\Stopwatch::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)

0

There are 0 answers