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');
}
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | advanced_help-argumentcounterror_for_anon-3110233-4.patch | 1.43 KB | gisle |
Comments
Comment #2
gisleI am unable to reproduce this.
When I visit
/search/advanced_help/xas 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?
Comment #3
gisleI 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".
Comment #4
gisleOK, I think I found it.
Please review the attached patch.
Comment #6
gisleThe patch is #4 has been pushed to the repo.