Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hiya,
I've spotted what I think is a bug with the menu callback definition for admin/people/expired - the definition looks like this in the latest -dev and 1.3 code:
$items['admin/people/expired'] = array(
'title' => 'Expired accounts',
'type' => MENU_LOCAL_TASK,
'description' => 'Lists all expired accounts.',
'page callback' => 'password_policy_expired_list',
'page arguments' => array('password_policy_list_expired'),
'access arguments' => array('unblock expired accounts'),
);
... which causes the following PHP error:
Fatal error: require_once(): Failed opening required '.../sites/all/modules/contrib/password_policy/user.admin.inc' (include_path='...') in .../includes/menu.inc on line 515
Adding a 'file' key to the array fixes it:
$items['admin/people/expired'] = array(
'title' => 'Expired accounts',
'type' => MENU_LOCAL_TASK,
'description' => 'Lists all expired accounts.',
'page callback' => 'password_policy_expired_list',
'page arguments' => array('password_policy_list_expired'),
'access arguments' => array('unblock expired accounts'),
'file' => 'password_policy.admin.inc',
);
I will attach this as a patch to the first comment - brb :)
Al
Comments
Comment #1
alexharries CreditAttribution: alexharries commentedPatch attached against latest 1.x-dev version - one of my first patches, so hopefully it will all be ok!
Comment #2
alexharries CreditAttribution: alexharries commentedAck, patch ignored due to issue status - I'll trying to change it to "Patch (to be ported)" and re-attach.
Comment #3
alexharries CreditAttribution: alexharries commentedRight, third time lucky? According to this bug report about vague "patch ignored" messages, I need to set it to "Needs review"...? http://drupal.org/node/1162082
Comment #4
alexharries CreditAttribution: alexharries commentedHuzzah, that got it :)
Comment #5
erikwebb CreditAttribution: erikwebb commentedThe password_policy_expired_list() function is actually in password_policy.module. The error you would see is something like "Call to undefined function password_policy_expired_list()", if that were the problem. (I agree it's not the right place, but that's a separate issue.)
In your error message, I'm not sure why it would be asking for '.../sites/all/modules/contrib/password_policy/user.admin.inc'. That's really odd. I honestly have no idea what this error refers to.
Comment #6
erikwebb CreditAttribution: erikwebb commentedI've reformatted your patch without all the whitespace changes. Please confirm it still fixes the problem for you.
Comment #7
torpy CreditAttribution: torpy commentedThe issue is that all paths under 'admin/people' fall under the 'user.admin.inc' pages file because that's where the menu callback for the 'admin/people' path is defined.
Due to the Drupal menu system, it considers all subpaths to really be under the main path. i.e. it seems to be doing some weird inheritance of properties, where if you define a menu path such as 'admin/people/blah', it will look at the definition for 'admin/people' for properties. The fix is to manually define a file in hook_menu.
I've change the file definition in hook_menu to point to 'password_policy.module' because thats where the menu callback function 'password_policy_expired_list' is defined.
Updated patch attached against 1.x-dev. :)
Comment #8
erikwebb CreditAttribution: erikwebb commentedI wonder if this is really a core bug that should be raised (or noted) instead of something to workaround here.
We have tests that check these pages and don't seem to have issues. I wonder why SimpleTest would pass, but your normal Drupal installation would fail.
Comment #9
torpy CreditAttribution: torpy commentedIt could very well be a core bug, just reading over the inheritance rules (https://drupal.org/node/146172) and _menu_router_build() (https://api.drupal.org/api/drupal/includes%21menu.inc/function/_menu_rou...) seem to suggest that if you provide a 'page callback' function in your menu definition, the 'file' property should not be inherited.
Comment #10
erikwebb CreditAttribution: erikwebb commentedComment #11
AohRveTPV CreditAttribution: AohRveTPV commentedHow can this bug be reproduced? Hard to determine whether it is a core bug or a module bug without being able to reproduce it.
Comment #12
AohRveTPV CreditAttribution: AohRveTPV commentedCan't reproduce this when browsing to
admin/people/expired
--no errors.About a month has passed since asking for more information on how to reproduce. Please re-open if this error still occurs.