Skip to content

Prevent "undefined index" notice if $parts array is empty in Index\Index#removeIndexedDefinition#750

Open
asccc wants to merge 1 commit intofelixfbecker:masterfrom
asccc:master
Open

Prevent "undefined index" notice if $parts array is empty in Index\Index#removeIndexedDefinition#750
asccc wants to merge 1 commit intofelixfbecker:masterfrom
asccc:master

Conversation

@asccc
Copy link

@asccc asccc commented Aug 1, 2019

If $level reaches 0 with only one more element in the $parts array, the next call to array_slice($parts, 0, $level) will return an empty array. This will trigger a "undefined index" notice in the next recursion on $part = $parts[$level]. This notice gets promoted to an ErrorException in the error-handler (if the local php.ini is configured to report notices) which will cancel further processing.

Fixes #695

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined Offset: 0

1 participant