magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.52k stars 9.31k forks source link

Magento2 redirects to homepage instead of showing error with wrong menu declaration #36632

Open ioweb-gr opened 1 year ago

ioweb-gr commented 1 year ago

Summary

When making a new admin menu item if you forget something in the definition e.g. forget parent menu or an action

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Ioweb_EcardSupplier::supplier" title="Supplier" module="Ioweb_EcardSupplier" resource="Ioweb_EcardSupplier::toggle" />
    </menu>
</config>

And try to log in to the backend, the system just redirects you to the homepage of the website. This makes troubleshooting other people's code harder. I would be better if an explicit error is shown.

Examples

Create a module with this in /etc/adminhtml/menu.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Ioweb_EcardSupplier::supplier" title="Supplier" module="Ioweb_EcardSupplier" resource="Ioweb_EcardSupplier::toggle" />
    </menu>
</config>

Proposed solution

Magento should thrown an exception regarding the faulty xml file so that developers can fix easily.

Additional information to issue reproduction

We have tried to reproduce the issue in Magento 2.4-develop instance and we are getting different errors of parent or action attributes are missing. We are getting the ERR_TOO_MANY_REDIRECTS error.

image

In order to reproduce the issue, we have made the below custom module: Magz.zip

But if we add the action attribute the issue has been resolved. Also, there is no error/exception logged in the logs file. Hence confirming the issue.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @ioweb-gr. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 1 year ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 year ago

Hello @ioweb-gr,

Thanks for the reporting and collaboration!

We have tried to reproduce the issue in Magento 2.4-develop instance and we are getting different errors of parent or action attributes are missing. We are getting the ERR_TOO_MANY_REDIRECTS error.

image

In order to reproduce the issue, we have made the below custom module: Magz.zip

But if we add the action attribute the issue has been resolved. Also, there is no error/exception logged in the logs file. Hence confirming the issue.

Thanks

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7543 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.