From 720af19346b48e0e57a7b360447f301c0eb99ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Sat, 6 Jul 2019 16:04:23 +0200 Subject: [PATCH] [Stopwatch] Add null check for id argument in Section::open() --- src/Symfony/Component/Stopwatch/Section.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Stopwatch/Section.php b/src/Symfony/Component/Stopwatch/Section.php index f297a548fce60..d4ce2cc37ef45 100644 --- a/src/Symfony/Component/Stopwatch/Section.php +++ b/src/Symfony/Component/Stopwatch/Section.php @@ -58,7 +58,7 @@ public function __construct(float $origin = null, bool $morePrecision = false) * * @return self|null The child section or null when none found */ - public function get(?string $id) + public function get(string $id) { foreach ($this->children as $child) { if ($id === $child->getId()) { @@ -76,7 +76,7 @@ public function get(?string $id) */ public function open(?string $id) { - if (null === $session = $this->get($id)) { + if (null === $id || null === $session = $this->get($id)) { $session = $this->children[] = new self(microtime(true) * 1000, $this->morePrecision); }