From 5a4605f2ea62c84454a6dbb4b81129517ddfad7e Mon Sep 17 00:00:00 2001 From: asc <42143765+asccc@users.noreply.github.com> Date: Thu, 1 Aug 2019 21:12:13 +0200 Subject: [PATCH] Prevent ErrorException if $parts is empty If `$level` reaches 0, `array_slice($parts, 0, $level)` returns an empty array. This will issue a "undefined index notice" in the next recursion on `$part = $parts[$level]`. This notice gets transformed to an ErrorException which will cancel further analysis. --- src/Index/Index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Index/Index.php b/src/Index/Index.php index 0d61f9ca..e8ec32ac 100644 --- a/src/Index/Index.php +++ b/src/Index/Index.php @@ -423,6 +423,10 @@ private function indexDefinition(int $level, array $parts, array &$storage, Defi */ private function removeIndexedDefinition(int $level, array $parts, array &$storage, array &$rootStorage) { + if (empty($parts)) { + return; + } + $part = $parts[$level]; if ($level + 1 === count($parts)) {