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).
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | memcache-admin_menu-name-collision-1807914-6.patch | 977 bytes | erikwebb |
| #5 | memcache-admin_menu-name-collision-1807914-5.patch | 971 bytes | markpavlitski |
| #3 | memcache-admin_menu-name-collision-1807914-3.patch | 1014 bytes | markpavlitski |
Comments
Comment #1
erikwebb commentedUnfortunately 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.
Comment #2
markpavlitski commentedA 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.Comment #3
markpavlitski commentedOn 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.
Comment #4
erikwebb commentedI'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.
Comment #5
markpavlitski commented@erikwebb That's a fair point.
This patch takes the backtrace approach instead.
Comment #6
erikwebb commentedShouldn't we be checking for the memcache_admin module instead?
Comment #7
markpavlitski commented@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.
Comment #8
erikwebb commentedVery true. RTBC for the patch in #5 (NOT #6!).
Comment #9
queenvictoria commentedDoes this need porting for D7 or is there a separate issue?
Comment #10
marcingy commentedThis needs to be fixed in d7 first and backported
Comment #11
markpavlitski commentedAs 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).
Comment #11.0
markpavlitski commentedAdded example log message.
Comment #13
jeremy commentedSorry that this sat here so long -- committed:
http://cgit.drupalcode.org/memcache/commit/?id=eddb92e