Hi everyone,
I am experiencing a very weird thing and I hope someone can shine some light on what may be happening.

For example: I have two features. One contains a menu with a few links. This one is enabled by my installation profile. I have a second feature that contains a menu link to add to the menu created by feature #1. The weird thing is that this link appears before the second feature is enabled!

Nowhere in the code of feature #1 is there any reference to the link of feature #2. If to be sure I manually
delete the link and recreate the first feature and create the second one from scratch, the same thing keeps happening.

When I create the first feature from scratch, add the menu link to its menu, export it with a new second feature, and create a whole new site (remember the first feature is completely untouched) I again get my menu link immediatly when the install finishes. Before I even view the sisabled second feature that actually contains the link.

When I manually delete the link after it wrongfully appears, it seems to work as intended. Through enabling and disabling the second feature the links comes and goes.

I am completely baffled by the question of how the first feauture has a memory of a manually added link that is not in any way included in its code. It has only be a part of its menu to be included in feature #2 and feature #1 was never recreated once that one was exported.
I checked on different machines and browsers to see if this is caused by temporary browser stuff but no, the link that can't be is really there.

What I am wondering about though, is the fact that the address the link points to also exists in the admin menu. But since the second feature has no problem adding the link that does not appear to be a problem. And besides, there is no information on the link in the first feauture anyway!

The link by the way, points to admin/settings/FAQ but the same thing happens when I point it to somewhere else in the admin section. If I create 3 features, 1 to implement the menu's, the second to add to those several links to admin pages it all works. But when a third feature is present to add an additional link, it appears prematurely (before I enable the third feature).

I am really lost because this is defying the laws of nature as far as I can tell.

I'm very curious to hear any thoughts, thanks in advance!


hefox’s picture

Title: Spooky action at a distance - menu items apear before they are supplied » Menu links from disabled features are being created
Priority: Normal » Major

#1244022: Menu Items Are Still Created Via hook_menu_default_menu_links() Even When Feature is Disabled is duplicate with more information

It'd be nice if either of you did a debug_backtrace to see what is calling the disabled hook.

djac’s picture

Please see #1244022: Menu Items Are Still Created Via hook_menu_default_menu_links() Even When Feature is Disabled for more specifics on my encounter with this issue.

I have two features. When I enable feature A, menu_default_menu_links() is being called for feature B, which is disabled.

When I enable Feature A on the Modules page, here is the output of debug_backtrace() which I added to feature_b_menu_default_menu_links().

Function called : feature_b_menu_default_menu_links
Function called : call_user_func
Function called : features_get_default
Function called : menu_links_features_rebuild_ordered
Function called : menu_links_features_rebuild
Function called : call_user_func_array
Function called : features_invoke
Function called : _features_restore
Function called : features_rebuild
Function called : features_form_system_modules_alter
Function called : call_user_func_array
Function called : drupal_alter
Function called : drupal_prepare_form
Function called : drupal_get_form
Function called : call_user_func_array
Function called : menu_execute_active_handler

It looks like things might be breaking when features_get_default() is called. The only argument being passed in is 'menu_links'.

uberEllis’s picture


AlfTheCat’s picture

Hey guys thanks for the info. I am currently refactoring the installation profile and all it's features because I have a gut feeling about something in Drupal core may be a culprit. I never had this issue with version 6.20. It appears to me this is brought on by 6.22.

As soon as I have more details I'll post them.

hefox’s picture

dubois’s picture

Patch #1256992 from #5 worked for me.

AlfTheCat’s picture

Yep. patch #5 did the job.

redndahead’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Status: Needs work » Reviewed & tested by the community
520 bytes

So here is a d7 version. Any reason why this shouldn't be committed?

hefox’s picture

At what stage feature api functions be checking on enabled modules? Since features needs to display and calculate information from disabled modules, many of it's api functions sometimes need to gather information on disabled modules, so exactly where in line this needs to happen is debatable.

If this function is one of them (used to calculate disabled information); there's various functions that are in a similar state and likely the whole bunch of them need to change. There's a huge chance for bugs though, as this effects a core api function for features.

hefox’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +D7

Never got an answer, but my current thoughts is that most of those functions need to be able to default to enabled only, but have a toggle for disabled, so going to redo based on that.

hefox’s picture

Wrong tag.

Marking this as this might mean a significant change to various functions.

smichel’s picture

FWIW, I encountered this issue today when doing a rebuild of a site. We had some menus in a feature which was disabled, and when the site was rebuilt the menus appeared. We didn't have anything that listed the feature as a dependency and when we looked at the features page, sure enough it was disabled.

Our feature was an atavism, left over from some other work. Getting it out of the modules tree removed the issue on the next rebuild.

mpotter’s picture

Definitely need to get some eyes on this one. It got missed in the 1.0 release, so I'm removing the "stable release blocker" flag. This is definitely a potentially complex issue, but now that we are back in more of a "dev" state working towards 1.1, this would be a good time to start playing with cleaning up whether or not we look at disabled modules or not.

rar’s picture

Found this out is still happening. Is there a way you can specify in features which menu items are disabled?

alexweber’s picture

any news on this, it's driving me crazy...

Alex Zhulin’s picture

Added a flag to features_get_default() function to switch between all features and enabled features.
Call to features_get_default() function from menu_links_features_rebuild_ordered() has this flag enabled, so menu links from only enabled features will be created.

Updated patch from #8.

RavindraSingh’s picture

Status: Needs work » Postponed (maintainer needs more info)

I believe here something is going wrong in approach. Please correct me if I am wrong. Below would be my approach which I would take to fix these kinds of issues.
I will not create a new feature (feature 2).
Will recreate feature 1 and store it at a different location. (e.g sites/all/modules/features )
Then it needs to be rebuild in system table which is easy to do.

For now I am pushing this issue for more information.

mpotter’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Closed (works as designed)

Somebody needs to re-open this if it's still a problem in the latest 2.x version and summarize/clarify what the exact issue still is.