1
0
Fork 0

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.
pull/750/head
asc 2019-08-01 21:12:13 +02:00 committed by GitHub
parent 9dc1656592
commit 5a4605f2ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -423,6 +423,10 @@ class Index implements ReadableIndex, \Serializable
*/ */
private function removeIndexedDefinition(int $level, array $parts, array &$storage, array &$rootStorage) private function removeIndexedDefinition(int $level, array $parts, array &$storage, array &$rootStorage)
{ {
if (empty($parts)) {
return;
}
$part = $parts[$level]; $part = $parts[$level];
if ($level + 1 === count($parts)) { if ($level + 1 === count($parts)) {