Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'taxonomy_access_admin' not found or invalid function name in menu_execute_active_handler() (line 503 of /var/www//includes/menu.inc).

This is because 'file' is not specified in the menu definition in taxonomy_access_hook_menu. I have a patch which I'll commit when I get a nid for this issue.

Comments

cameron tod’s picture

Attaching patch.

xjm’s picture

Status: Active » Needs review

Need to set it to NR to go through testbot.

xjm’s picture

Status: Needs review » Needs work
+++ b/taxonomy_access.moduleundefined
@@ -122,37 +122,38 @@ function taxonomy_access_theme() {
+  $base = array(
+    'file' => 'taxonomy_access.admin.inc',
+    'type' => MENU_CALLBACK,
+  );

For clarity, I'd prefer to explicitly specify this on each item rather than performing the addition.

Also, this file should be getting added by hook_init():

/**                                                                             
 * Implements hook_init().                                                      
 */
function taxonomy_access_init() {
  if (arg(0) == 'admin') {
    // Only include administrative callbacks and css on admin pages.            
    $path = drupal_get_path('module', 'taxonomy_access');
    include_once($path . '/taxonomy_access.admin.inc');
    drupal_add_css($path . '/admin.css');
  }

If we are replacing the legacy pattern with a proper include via hook_menu(), we should also remove it from there.

xjm’s picture

Also, could you provide more information on the circumstances under which you get this error message? I am unable to duplicate it.

cameron tod’s picture

Status: Needs work » Needs review
StatusFileSize
new1.9 KB

I installed the module using drush I then couldn't see any menu options at admin/config or admin/people/permissions, so I went to admin/modules to config from there - then when clicking through to admin/config/people/taxonomy_access got a wsod. Checking the logs showed the 'not found or invalid function name' error.

I tried both alpha and dev branches, and the same thing happened.

I'm not sure why the include is not working in my case - it could be because of caching (I also use an apc cache, I'm not sure if there are some gotchas there).

Having taxonomy_access.admin.inc included automatically by the menu system seems cleaner to me. I think there are some gotchas with hook_init on cached page views - although that's not an issue for admin pages, I think the hook_menu route is accepted best practice.

Attaching re-rolled patch.

xjm’s picture

Odd, I use APC, and I've never had this problem. In any case this is a good patch; I've been meaning to move various legacy patterns throughout the module into hook_menu() for awhile. (TAC dates back to D4.5 days.) :)

We do need to include the admin CSS somehow. I'm on the fence about just attaching it to the admin form instead.

Edit: Just thought of something. If hook_init() does not run for you generally, that would also break the module pretty badly (corrupting node access) because the shutdown function would not be registered. It may be I just need to move the shutdown function registration into hook_boot(). Are you using aggressive caching?

Edit: See #1273080: [Rollback] Move registration of shutdown function from hook_init() into hook_boot().

xjm’s picture

Status: Needs review » Fixed
cameron tod’s picture

Cool, thanks for rolling that in. Sorry I sort of abandoned this one, I've been really flat out. I don't use aggressive caching, so I'm not sure what happened really.

Updating my sites to the latest rc now :)

Status: Fixed » Closed (fixed)

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