No Code Attached Yet
avatar carsten888
3 Mar 2015

Steps to reproduce the issue

Install a system plugin which overrides the Joomla Jmenu class as described here:
Enable the system plugin Language Filter.

Expected result

you would expect the custom plugin to be able to override the class as documented, like it worked for years.

Actual result

since Joomla 3.4.0:
Fatal error: Cannot redeclare class JMenu in [the custom plugin]

System information (as much as possible)

any system plugin which is overriding Jmenu

Additional comments


# of Users Experiencing Issue
Average Importance Score

avatar carsten888 carsten888 - open - 3 Mar 2015
avatar infograf768
infograf768 - comment - 3 Mar 2015

can you propose a PR?

avatar carsten888
carsten888 - comment - 3 Mar 2015

I'm not sure what you mean. sorry.

avatar mbabker
mbabker - comment - 3 Mar 2015

Once a class is loaded, there is no overriding it; that is a PHP behavior that cannot be controlled (you would hit the same issue trying this with any of the application classes, JProfiler, and JSession; among others). In 3.4, JMenu is loaded by the plugin's constructor, and the plugin is explicitly imported by the application class before the first plugin event. So there is not a way to overload JMenu in the current code.

avatar carsten888
carsten888 - comment - 3 Mar 2015

@mbabker yes after a class is already loaded, it can not be reloaded.

This method is documented here and has worked just fine for many years.
As of Joomla 3.4.0 the plugin 'system - Language Filter' loads the Jmenu class during its loading of the router on line 58. This changing behaviour of Joomla functionality is destroying functionality of 3rd party extensions.

Please consider setting the '$this->mode_sef' on line 59 is some other way which does not conflict.

avatar infograf768
infograf768 - comment - 4 Mar 2015

Can you test #6278

avatar brianteeman brianteeman - change - 4 Mar 2015
Labels Added: No Code Attached Yet
avatar Hackwar Hackwar - change - 16 Mar 2015
Status New Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2015-03-16 22:16:33
Closed_By Hackwar
avatar joomla-cms-bot joomla-cms-bot - change - 16 Mar 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-03-16 22:16:34
avatar joomla-cms-bot joomla-cms-bot - close - 16 Mar 2015
avatar joomla-cms-bot
joomla-cms-bot - comment - 16 Mar 2015

Set to "closed" on behalf of @Hackwar by The JTracker Application at

avatar joomla-cms-bot joomla-cms-bot - close - 16 Mar 2015
avatar Hackwar
Hackwar - comment - 16 Mar 2015

This has been fixed with #6278

This comment was created with the J!Tracker Application at
avatar carsten888
carsten888 - comment - 19 Jun 2016

This issue is back in Joomla 3.5.1
Again language filter plugin seems to load the menu-class before any other plugin can override it.

This comment was created with the J!Tracker Application at

avatar mbabker
mbabker - comment - 19 Jun 2016

1) Instead of commenting on an issue that's been closed for over a year, you should be opening a new issue (and at least reference this one).

2) I did some checks the other day with the current 3.6 beta and the JMenu class chain is NOT being loaded before the onAfterInitialise event is dispatched. Actually the full list of loaded classes for a couple scenarios can be found at so I'm going to suggest that something else is causing the menu classes to load.

3) Relying on overloading core classes is dangerous and shouldn't be considered as a long term option as it creates an unpredictable API for anyone using overloaded classes. I know there's a lot of infrastructure in core that is hardcoded to specific patterns, those need to be fixed and extension developers need to be trained to not overload the core API when those are fixed.

Add a Comment

Login with GitHub to post a comment