There appeared to be an error during the building of the admin menu on page load that started to occur when I upgraded php from 5.3 to 7.1.
This is the error:
ArgumentCountError: Too few arguments to function field_ui_admin_access(), 1 passed in /app/includes/menu.inc on line 647 and exactly 2 expected in field_ui_admin_access()
This is the callstack when i print debug_backtrace():
... (Array, 17 elements)
0 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 943
function (String, 18 characters ) _menu_check_access | (Callback) _menu_check_access();
args (Array, 2 elements)
1 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1528
function (String, 20 characters ) _menu_link_translate | (Callback) _menu_link_translate();
args (Array, 1 element)
2 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1531
function (String, 23 characters ) _menu_tree_check_access | (Callback) _menu_tree_check_access();
args (Array, 1 element)
3 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1531
function (String, 23 characters ) _menu_tree_check_access | (Callback) _menu_tree_check_access();
args (Array, 1 element)
4 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1531
function (String, 23 characters ) _menu_tree_check_access | (Callback) _menu_tree_check_access();
args (Array, 1 element)
5 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1531
function (String, 23 characters ) _menu_tree_check_access | (Callback) _menu_tree_check_access();
args (Array, 1 element)
6 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1518
function (String, 23 characters ) _menu_tree_check_access | (Callback) _menu_tree_check_access();
args (Array, 1 element)
7 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1371
function (String, 22 characters ) menu_tree_check_access | (Callback) menu_tree_check_access();
args (Array, 2 elements)
8 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 1163
function (String, 15 characters ) menu_build_tree | (Callback) menu_build_tree();
args (Array, 2 elements)
9 (Array, 4 elements)
file (String, 56 characters ) /app/sites/all/modules/contrib/admin_menu/admin...
line (Integer) 44
function (String, 18 characters ) menu_tree_all_data | (Callback) menu_tree_all_data();
args (Array, 1 element)
10 (Array, 4 elements)
file (String, 59 characters ) /app/sites/all/modules/contrib/admin_menu/admin...
line (Integer) 507
function (String, 15 characters ) admin_menu_tree | (Callback) admin_menu_tree();
args (Array, 1 element)
11 (Array, 4 elements)
file (String, 59 characters ) /app/sites/all/modules/contrib/admin_menu/admin...
line (Integer) 201
function (String, 17 characters ) admin_menu_output | (Callback) admin_menu_output();
args (Array, 1 element)
12 (Array, 4 elements)
file (String, 24 characters ) /app/includes/common.inc
line (Integer) 5922
function (String, 21 characters ) admin_menu_page_build | (Callback) admin_menu_page_build();
args (Array, 1 element)
13 (Array, 4 elements)
file (String, 24 characters ) /app/includes/common.inc
line (Integer) 2752
function (String, 18 characters ) drupal_render_page | (Callback) drupal_render_page();
args (Array, 1 element)
14 (Array, 4 elements)
file (String, 24 characters ) /app/includes/common.inc
line (Integer) 2625
function (String, 24 characters ) drupal_deliver_html_page | (Callback) drupal_deliver_html_page();
args (Array, 1 element)
15 (Array, 4 elements)
file (String, 22 characters ) /app/includes/menu.inc
line (Integer) 542
function (String, 19 characters ) drupal_deliver_page | (Callback) drupal_deliver_page();
args (Array, 2 elements)
16 (Array, 4 elements)
file (String, 14 characters ) /app/index.php
line (Integer) 21
function (String, 27 characters ) menu_execute_active_handler | (Callback) menu_execute_active_handler();
args (Array, 0 elements)
The error looks like it occurs on the function call to menu_check_access. These are the arguments that get passed to that function:
[args] => Array
(
[0] => Array
(
[menu_name] => management
[mlid] => 2198
[plid] => 88
[link_path] => admin/config/people/accounts/display
[router_path] => admin/config/people/accounts/display
[link_title] => Manage display
[options] => Array
(
)
[module] => system
[hidden] => -1
[external] => 0
[has_children] => 0
[expanded] => 0
[weight] => 2
[depth] => 5
[customized] => 0
[p1] => 1
[p2] => 8
[p3] => 48
[p4] => 88
[p5] => 2198
[p6] => 0
[p7] => 0
[p8] => 0
[p9] => 0
[updated] => 0
[load_functions] =>
[to_arg_functions] =>
[access_callback] => field_ui_admin_access
[access_arguments] => a:1:{i:0;s:24:"administer user settings";}
[page_callback] => drupal_get_form
[page_arguments] => a:4:{i:0;s:30:"field_ui_display_overview_form";i:1;s:4:"user";i:2;s:4:"user";i:3;s:7:"default";}
[delivery_callback] =>
[tab_parent] => admin/config/people/accounts
[tab_root] => admin/config/people/accounts
[title] => Manage display
[title_callback] => t
[title_arguments] =>
[theme_callback] =>
[theme_arguments] => a:0:{}
[type] => 132
[description] =>
[in_active_trail] =>
[href] => admin/config/people/accounts/display
[access] =>
)
[1] => Array
(
[0] => admin
[1] => config
[2] => people
[3] => accounts
[4] => display
)
)
Any suggestions are highly appreciated!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | adminmenu_3000678_php71-1.patch | 575 bytes | katie.bielawiec |
Comments
Comment #2
pganore1@gmail.com commentedon line 291 try adding this for now to temporarily resolve this issue. on field_ui.module in core (/modules/field_ui/field_ui.module)
elseif (function_exists($access_callback)) {
if(!isset($args[1])) {
global $user; // current user object
$args[1] = $user; // the default value which the function passess if this value is not available
}
return call_user_func_array($access_callback, $args);
}
Ref: https://api.drupal.org/api/drupal/modules!user!user.module/function/user...
Comment #3
Clemence.Blazy commented#2 worked perfectly for me. Thanks!
Comment #4
katie.bielawiec commentedPatch for #1
Comment #5
liam morlandComment #6
jpoesen commentedI wasn't able to apply the patch in #4, but manually updating the code did work. Thanks!
Comment #7
liam morland@jpoesen Could you post your patch?
Comment #8
jpoesen commentedI actually have to retract that.
The solution in #2 prevents a white screen of death, but PHP warnings are still being logged.
Also:
Comment #9
jpoesen commentedIn my case, the problem was caused by an outdated version of the menu_fields module: https://www.drupal.org/project/menu_fields/issues/2837934
For those interested, the menu_fields patch in question: https://git.drupalcode.org/project/menu_fields/commit/ac800ed