function profile2_regpath_attach_profile_fields(&$form, &$form_state, $form_id, $profile_types = NULL) {
  [..]
    foreach ($profile_types as $type_name => $value) {
      [..]
      foreach ($profile_roles as $rid => $value) {

This does not currently cause any problems, because the inner foreach() is the last thing that happens in the outer foreach(), so $value is not used anymore. But it is the kind of stuff that at some point inevitably leads to bugs.

How to fix:
- Rename the inner foeach variable.
- Generally use more meaningful variable names. $value could be anything.
- Use an IDE that detects this kind of stuff. Aim at 0% IDE warnings. Life really is much better this way.

See also #2708429: profile2_regpath_schema(): Let Drupal do the (un)serialize! - store 'roles' as 'blob' + 'serialize', to avoid having to manually unserialize it.

Comments

donquixote created an issue.