? ? ? Pending

User tests: Successful: Unsuccessful:

avatar sakiss
sakiss
15 Oct 2020

Pull Request for Issue # .
#30812

Summary of Changes

$app->getMenu()->getActive();
can return a MenuItem or null

by calling a function when null is returned, it generates a fatal error.

Testing Instructions

Add a dummy/non existent ItemId in your non sef urls.
E.g. /index.php?option=com_content&view=article&id=2:another-article&catid=9&itemId=5000
In that case there is no menu item with id 5000

Actual result BEFORE applying this Pull Request

Screenshot_joomla_missing_menu_ietm

Expected result AFTER applying this Pull Request

No fatal error

Documentation Changes Required

No

avatar sakiss sakiss - open - 15 Oct 2020
avatar sakiss sakiss - change - 15 Oct 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Oct 2020
Category Front End Templates (site)
avatar SharkyKZ
SharkyKZ - comment - 15 Oct 2020

Can you do it the same as in error.php?

$menu = $app->getMenu()->getActive();
$pageclass = $menu !== null ? $menu->getParams()->get('pageclass_sfx', '') : '';

Otherwise $pageclass is undefined when no menu item.

avatar sakiss sakiss - change - 15 Oct 2020
Labels Added: ?
avatar richard67
richard67 - comment - 15 Oct 2020

@SharkyKZ This PR here changes error.php, too, and I don't understand why. It was ok like it was before, or not? Am I missing something?

avatar richard67
richard67 - comment - 15 Oct 2020

@sakiss Please revert your change in error.php. It was good like it was before, using the ternary expression, and you now introduced an error with undefined $pageclass when there is no menu item. And as @SharkyKZ suggested please change index.php so it uses the same ternary expression as error.php does without your change.

avatar richard67
richard67 - comment - 15 Oct 2020

@sakiss And in addition to the above comment, please update the branch of this PR to the latest 4.0-dev branch of the CMS repository, not of your fork. It seems your 4.0-dev branch was very outdated when you have created this PR and the other one, #31099 based on it, because both PRs fail in our automated test due to outdated testing configuration from before February.

Let me know if you need help with.

Thanks in advance.

avatar richard67
richard67 - comment - 16 Oct 2020

Added the "Updates Requested" label so it's clear for testers that this PR needs changes as specified in review comments above.

avatar sakiss sakiss - change - 16 Oct 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 16 Oct 2020
Category Front End Templates (site) Unit Tests Repository Administration
avatar sakiss
sakiss - comment - 16 Oct 2020

I am closing this due to conflicts. Will open a new one.

avatar sakiss sakiss - change - 16 Oct 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-10-16 17:58:25
Closed_By sakiss
Labels Added: ?
avatar sakiss sakiss - close - 16 Oct 2020

Add a Comment

Login with GitHub to post a comment