There is a Drupal Core hook_menu() that allows modules to define menu items and callbacks. There is also an admin_menu hook_admin_menu() that lets modules define their menu items, layout and parents in the top administration menu.

Since hooks are defined as $module_name . '_' . $hook_name, when the admin_menu module attempts to call hook_admin_menu() for the memcache module, it gets memcache_admin's hook_menu() function instead and generates a number of watchdog warnings.

The warnings generated are:

Notice: Undefined index: path in admin_menu_link_build() (line 67 of /path/to/drupal/sites/all/modules/admin_menu/admin_menu.inc).

Comments

erikwebb’s picture

Component: Code » memcache_admin

Unfortunately since there really is no resolution other than renaming modules, this isn't really fixable. It's difficult to use function_exists() or something to conditionally include Memcache Admin, because the load order may be affected.

The only real "fix" here is to alert the user when this combination of modules is enabled. For D6 this can only be done at the time of install. For D7 maybe we could use hook_modules_enabled() to alert the user.

markpavlitski’s picture

A workaround could be achieved by looking at the PHP backtrace to determine the caller.

The same technique is used in MemCacheDrupal::clear() in the 7.x version.

markpavlitski’s picture

Status: Active » Needs review
StatusFileSize
new1014 bytes

On further inspection, hook_admin_menu() is called with a parameter whereas hook_menu() is not, so there is an easy enough workaround for this.

Patch attached.

erikwebb’s picture

Status: Needs review » Needs work

I'm more comfortable with a backtrace, because as is we are assuming that Admin Menu won't change their API. Seems like a bad precedent to use.

If we do use this method, we can just use func_num_args() for simplicity.

markpavlitski’s picture

Version: 6.x-1.10 » 6.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new971 bytes

@erikwebb That's a fair point.

This patch takes the backtrace approach instead.

erikwebb’s picture

Shouldn't we be checking for the memcache_admin module instead?

markpavlitski’s picture

@erikwebb The issue only occurs when memcache, memcache_admin and admin_menu modules are all enabled.

Since the code is run inside memcache_admin.module we know it's enabled already, so we only need to check for the other two.

If only memcache_admin and admin_menu modules are enabled (not memcache) the issue won't occur.

erikwebb’s picture

Status: Needs review » Reviewed & tested by the community

Very true. RTBC for the patch in #5 (NOT #6!).

queenvictoria’s picture

Does this need porting for D7 or is there a separate issue?

marcingy’s picture

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

This needs to be fixed in d7 first and backported

markpavlitski’s picture

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

As far as I can tell this issue only occurs in D6.

hook_admin_menu() only exists in the 6.x branch of the admin_menu module. The 7.x branch of admin_menu uses a set of hooks with different naming conventions which don't overlap with the memcache/memcache_admin modules.

I'm marking this back to RTBC for the patch in #5 (6.x-dev).

markpavlitski’s picture

Issue summary: View changes

Added example log message.

  • Jeremy committed eddb92e on 6.x-1.x authored by markpavlitski
    Issue #1807914 by markpavlitski, erikwebb: Name collision between...
jeremy’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Sorry that this sat here so long -- committed:
http://cgit.drupalcode.org/memcache/commit/?id=eddb92e

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.