Make sure the view exists before adding it to the menu lookup array, remove PHP Notices #18564
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Other solution for the same problem as in #17323, #18043
Summary of Changes
Do not add view name to the menu
lookup
array if the view does not exists.Remove PHP Notice:
Notice: Undefined index: loginx in .../libraries/src/Component/Router/Rules/MenuRules.php on line 216
Notice: Trying to get property of non-object in .../libraries/src/Component/Router/Rules/MenuRules.php on line 216
Testing Instructions
Install joomla.
Go to backend and edit a menu item.
Change name of view in the link field and save.
![menu_check_view_name2](https://user-images.githubusercontent.com/9054379/32736026-bf39d21e-c896-11e7-9ba4-7f993101bf30.gif)
Please see attached video. I used FF Inspector (Ctrl + Shift + C)
Go to frontend in order to see changes.
Before PR there are 2 php notices, after PR they disappear.
Expected result
No PHP Notices
Actual result
PHP Notices.
Documentation Changes Required
No