If a username contains a space then that username will never show up in the "switch user" far right menu.

I've been able to figure a bit out about what's going on, but can't tell if it's a core, devel or a DAM bug.

Here's what I've figured out:

DAM calls devel_switch_user_list() via module_invoke('devel', 'switch_user_list') in admin_menu_admin_menu() to get the list of users who can be switched to.

Note that devel_switch_user_list() uses l() to generate the relevant link in the form "devel/switch/[username]". If username contains a space then the link generated is eg. "devel/switch/john%20doe" (as it should).

Later, _menu_link_translate() will return false because of this code (line 644 in 6.5):

// Note - skip callbacks without real values for their arguments.
if (strpos($item['href'], '%') !== FALSE) {
  $item['access'] = FALSE;
  return FALSE;
}

Because of this the DAM menu item for switching to "john doe" never gets added. Let me know if more info is needed.

CommentFileSizeAuthor
#2 admin_menu.patch467 bytesAltaVida

Comments

sun’s picture

Great report, and great analysis. Seems to be obvious that there should be a leading slash before the percent sign. Can you test whether that fixes this bug?

AltaVida’s picture

StatusFileSize
new467 bytes

I think I've got a really simple and straightforward fix:

We can simply urldecode() the path returned by devel_switch_user_list(). It seems to work perfectly.

See patch.

pwolanin’s picture

looking for /% might be a good idea for core, though it would miss those who foolishly try to put a leading % in their path.

sun’s picture

Status: Active » Fixed

@AltaVida: Makes even more sense.

Thanks, committed to all branches.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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