Where x is an arbitrary value

Anon users can hit /search/advanced_help/x and throw the following error:

ArgumentCountError: Too few arguments to function menu_tail_load(), 1 passed in /public_html/includes/menu.inc on line 604 and exactly 3 expected in menu_tail_load() (line 853 of /public_html/includes/menu.inc).

Perhaps a validation function is needed?

/**
 * Implements hook_menu_alter().
 */
function advanced_help_menu_alter(&$callbacks) {
  // We need to fix the menu item provided by search module to restrict access.
  $callbacks['search/advanced_help/%menu_tail']['access callback'] = 'user_access';
  $callbacks['search/advanced_help/%menu_tail']['access arguments'] = array('view advanced help index');
}

Comments

darkodev created an issue. See original summary.

gisle’s picture

Status: Active » Postponed (maintainer needs more info)

I am unable to reproduce this.

When I visit /search/advanced_help/x as anon at a clean install with all settings at the default (i.e. anon does not have access to search, nor to advanced help), I don't get any "ArgementCountError", but "Access denied", which is the correct response.

If I enable access for anon, I get this error: "You must include at least one positive keyword with 3 characters or more".

If I visit /search/advanced_help/node (i.e. a four letter word), I get a sensible result.

Can you please provide more information about how to reproduce the "ArgementCountError" from a clean install?

gisle’s picture

Status: Postponed (maintainer needs more info) » Active

I found a way to reproduce. If you do not enable "Advanced help" as an active search module under Administration » Configuration » Search and metadata » » Search settings, you get this error. If you enable it, things work as described in comment #2.

Setting back to "Active".

gisle’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

OK, I think I found it.

Please review the attached patch.

  • gisle committed 3ee69a0 on 7.x-1.x
    Issue #3110233 by gisle: Fixed error on %menu_tail for anon
    
gisle’s picture

Assigned: Unassigned » gisle
Status: Needs review » Fixed

The patch is #4 has been pushed to the repo.

Status: Fixed » Closed (fixed)

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