hey guys, i think this is a core bug; bug i only see it showing up with pathauto so far so i'll report it here and perhaps you guys will have a better idea if this is a core bug or not (and maybe a little more clout to get it fixed).
i am using the token [user:roles:first] (although i am sure all role based tokens are affected) for defining urls for users as [user:roles:first]/[user:field_firstname]-[user:field_lastname]
an example resulting alias for a user in role "faculty" is: 4/melanie-smith
4 = faculty
the issue is that $form-state['user']['roles'] starts out like:
2 => authenticated-user 4 => faculty
but it hits this function: entity_form_submit_build_entity() and gets modified to:
array = 4: string = 4 2: bool = TRUE 3: long = 0 5: long = 0 6: long = 0 7: long = 0
i am not completely sure; but this gets busted at the call in common.inc at line 7679:
$values_excluding_fields = $info['fieldable'] ? array_diff_key($form_state['values'], field_info_instances($entity_type, $bundle)) : $form_state['values'];
which i think is meant to remove form state values which should not get modified. and $user or $user->roles should likely be in there.
just as a quick test, i removed $user->roles from this array and i then get my url as authenticated-user/melanie-smith (which isn't quite right either; but i closer)