Bug #13113
User menu breaks when there are no login, logout or myProfile menu options
Status: | Verified | Start date: | 07/18/2019 | |
---|---|---|---|---|
Priority: | Medium | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Menu / navigation | |||
Target version: | Release 2.5.2 | |||
Google Code Legacy ID: | Tested version: | 2.5, 2.6 | ||
Sponsored: | No | Requires documentation: |
Description
The bug fix of https://projects.artefactual.com/issues/12167 specifically this commit where hardcoded labels were removed https://github.com/artefactual/atom/commit/66724a1441abe100fc2dd74f840ec6cf611fd9d8 assumes that the login, logout and myProfile options are always present in the menu data.
If the user has deleted (or somehow renamed) one of those options the user menu partial breaks the UI when it tries to call getLabel on the non existing option here https://github.com/artefactual/atom/blob/a954dcc96500ce90f618e873a420f7e6e008ed42/apps/qubit/modules/menu/templates/_userMenu.php#L6.
This results in a traceback like the following:
2019/07/18 15:07:31 [error] 6#6: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to a member function getLabel() on null in /atom/src/apps/qubit/modules/menu/templates/_userMenu.php:6 Stack trace: #0 /atom/src/cache/qubit/prod/config/config_core_compile.yml.php(3895): require() #1 /atom/src/vendor/symfony/lib/view/sfPartialView.class.php(124): sfPHPView->renderFile('/atom/src/apps/...') #2 /atom/src/vendor/symfony/lib/helper/PartialHelper.php(157): sfPartialView->render() #3 /atom/src/apps/qubit/templates/_header.php(25): get_component('menu', 'userMenu') #4 /atom/src/cache/qubit/prod/config/config_core_compile.yml.php(3895): require('/atom/src/apps/...') #5 /atom/src/vendor/symfony/lib/view/sfPartialView.class.php(124): sfPHPView->renderFile('/atom/src/apps/...') #6 /atom/src/vendor/symfony/lib/helper/PartialHelper.php(220): sfPartialView->render() #7 /atom/src/apps/qubit/templates/layout_2col.php(19): get_partial('header') #8 /atom/src/cache/qubit/prod/config/config_core_compile.yml.php(3895): require('/atom/src/apps/...')
How to reproduce
Deleting the mentioned options is prevented after https://github.com/artefactual/atom/pull/752/files so I had to do it with SQL like this:
mysql> use atom; mysql> delete from menu where name='login';
After doing that any page will only display part of the header of the Dominion theme with no menu or content.
History
#1 Updated by David Juhasz almost 3 years ago
- Category set to Menu / navigation
- Status changed from New to Code Review
- Target version set to Release 2.5.2
Ready for Code Review: https://github.com/artefactual/atom/pull/934
#2 Updated by Dan Gillean almost 3 years ago
- Status changed from Code Review to In progress
- Assignee set to David Juhasz
Verified in qa/2.6.x - feel free to backport!
#3 Updated by David Juhasz almost 3 years ago
- Status changed from In progress to Verified
- Assignee deleted (
David Juhasz) - Tested version 2.5 added
Backported to stable/2.5.x https://github.com/artefactual/atom/commit/9621df0daa0561726c1e92c9faf420f9e2353e71