Patch 5994 is causing module Adminhtml 404 Status Error

The question:

I applied the Patch 5994 the other day and it has caused the admin section of a module I build to throw a 404. Has anyone else had this. The module is fine on the frontend though.

It’s Magento 1.8.1.0 and having rolled back through my commits it’s definitely Patch 5994 where everything went wrong.

Has anyone else experienced the same issue?

Below is my config.xml file for the module which I suspect holds the answer:

<config>
    <modules>
        <Company_Playzone>
            <version>0.1.0</version>
        </Company_Playzone>
    </modules>
    <frontend>
        <routers>
            <playzone>
                <use>standard</use>
                <args>
                    <module>Company_Playzone</module>
                    <frontName>playzone</frontName>
                </args>
            </playzone>
        </routers>
        <layout>
            <updates>
                <playzone>
                    <file>playzone.xml</file>
                </playzone>
            </updates>
        </layout>
    </frontend>
    <adminhtml>
        <layout>
            <updates>
                <playzone>
                    <file>playzone.xml</file>
                </playzone>
            </updates>
        </layout>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <playzone>
                            <title>Play Zone</title>
                            <sort_order>10</sort_order>
                        </playzone>
                    </children>
                </admin>
            </resources>
        </acl>
        <menu>
            <cms>
                <children>
                    <playzone_adminform module="playzone">
                        <title>Play Zone</title>
                        <children>
                            <activity module="playzone">
                                <title>Activities</title>
                                <action>playzone/adminhtml_activity</action>
                            </activity>
                            <category module="playzone">
                                <title>Categories</title>
                                <action>playzone/adminhtml_category</action>
                            </category>
                            <competition module="playzone">
                                <title>Competitions</title>
                                <action>playzone/adminhtml_competition</action>
                            </competition>
                        </children>
                    </playzone_adminform>
                </children>
            </cms>
        </menu>
    </adminhtml>
    <global>
        <helpers>
            <playzone>
                <class>Company_Playzone_Helper</class>
            </playzone>
        </helpers>
        <blocks>
            <playzone>
                <class>Company_Playzone_Block</class>
            </playzone>
        </blocks>
        <models>
            <playzone>
                <class>Company_Playzone_Model</class>
                <resourceModel>playzone_resource</resourceModel>
            </playzone>
            <playzone_resource>
                <class>Company_Playzone_Model_Resource</class>
                <entities>
                    <activity>
                        <table>playzone_activity</table>
                    </activity>
                    <category>
                        <table>playzone_category</table>
                    </category>
                    <competition>
                        <table>playzone_competition</table>
                    </competition>
                </entities>
            </playzone_resource>
        </models>
        <resources>
            <playzone_setup>
                <setup>
                    <module>Company_Playzone</module>
                    <class>Company_Playzone_Model_Resource_Setup</class>
                </setup>
            </playzone_setup>
            <playzone_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </playzone_write>
            <playzone_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </playzone_read>
        </resources>
    </global>
</config>

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

This is the new security feature in full effect as outlined by Cyrill Schumacher. He also was so kind as to provide the fix:

controller must extend admin html controller and config.xml routers
section must also use admin.

There is a very good explanation at Solving MagentoMagento Routers: a Look under the Hood.

If you need a custom router name, the section that needs to be added should look like this:

<config>
    ...
    <admin>
        <routers>
            <playzone>
                <use>admin</use>
                <args>
                    <module>Limesharp_Playzone</module>
                    <frontName>playzone</frontName>
                </args>
            </playzone>
        </routers>
    </admin>
    ...
</config>

It is more common to extend the router configuration though:

Update: As of Magento CE 1.9.2.2, the previous example is only applicable to frontend routes. Extending the router configuration is the way to go:

<config>
    ...
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Limesharp_Playzone before="Mage_Adminhtml">Limesharp_Playzone_Adminhtml</Limesharp_Playzone>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
    ...
</config>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment