When I add a menu item to user/register I end up with these errors, which are from Drupal core but seem to be as a result of this module.

Notice: Undefined variable: tab_root_map in _menu_translate() (line 791 of /var/www/guidedogs/includes/menu.inc).
Warning: implode(): Invalid arguments passed in _menu_translate() (line 791 of /var/www/guidedogs/includes/menu.inc).
Notice: Undefined variable: tab_parent_map in _menu_translate() (line 792 of /var/www/guidedogs/includes/menu.inc).
Warning: implode(): Invalid arguments passed in _menu_translate() (line 792 of /var/www/guidedogs/includes/menu.inc).

If I investigate that area of code I can see that this menu item has NULL for the $router_item['tab_root'] and $router_item['tab_parent'] whereas all the other menu items on that page have values for both, even if they are just empty strings.

On further investigation it seems that this is related to the use of http://example.com as the link that gets validated.
Because that is an external link then there is no Drupal router item tab stuff for that link when it is saved, but then when it is displayed later as a link to a page that is a menu tab you get problems.

CommentFileSizeAuthor
#2 any_menu_path-2423885-2.patch1.43 KBrooby

Comments

rooby’s picture

Issue summary: View changes
rooby’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

Here is a quick patch for a possible direction to head to address this.

It's still not ideal because the link will be stored with data relating to the front page router item, not whatever page you are linking to.

It is somewhat better though.

Seems like a hard one to get around but I will try to think of alternative solutions.

rooby’s picture

Oh, you also have to save any affected menu items after applying this (and flush the cache) to resolve the errors.

That could be done as an update function but I haven't had time to add that.

rooby’s picture

Actually I'm not sure that patch even fixes the problem at all.

Dexter2k’s picture

Did not fix it. When trying to patch:

Hunk #1 FAILED at 76.

But thanks for working on this issue :)

farald’s picture

There is an open issue in core aiming at getting rid of these notices:
https://www.drupal.org/node/951098

I can find no way to this to get rid of these errors at all from this module's perspective, given the fact that this module circumvents some core functionality for the menu items. The patch in the above issue, fixes the errors, but looks however like it might not get committed to core.

rooby’s picture

@farald: The issue you linked is this issue.

There is an issue here though that may make this module obsolete: #308263: Allow privileged users to bypass the validation of menu items
It has already been fixed in Drupal 8.

farald’s picture

@rooby, thanks, I fixed the link.
And thanks for the info, I was unaware of that.

Yep you're right, this will allow linking to any internal path (as long as the url isn't malformed).
In that case, if we can get a patch committed to core for 7.x, it would render this module unneeded.

farald’s picture

Status: Needs review » Closed (won't fix)

Marking as won't fix.