Problem/Motivation

ip_login_update_7300 upgrades the module data from 2.x to 3.x's use of field_ipaddress. However data in 2.x that is a comma-separated list of ip address ranges are not updated and the data is lost.

Instead the "Invalid IP range or address" message is printed because all of the ip addresses are added to the first element of field_ipaddress rather than being split into multiple elements.

if(empty($row->ip_match)) continue;
      // Try shorthand match
      $value = _field_ipaddress_shorthand2long(trim($row->ip_match));
      // Try CIDR match
      if(!$value && strpos($row->ip_match, '/') !== FALSE){
       $value = _field_ipaddress_cidr2long(trim($row->ip_match));
      }

Steps to reproduce

  1. Install the 7.x-2.x version.
  2. Add several IP Address ranges for a a user.
  3. Update to the 7.x-3.x version and install field_ipaddress module.
  4. Run the database update script.

Proposed resolution

Extract $row->ip_match into an array trimming whitespace.
Filter by valid ip addresses.
Set the field values to the entire array.

Issue fork ip_login-3294730

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mradcliffe created an issue. See original summary.

smokris made their first commit to this issue’s fork.

smokris’s picture

Status: Active » Needs review
amateescu’s picture

Status: Needs review » Closed (outdated)

Closing old issues.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.