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
- Install the 7.x-2.x version.
- Add several IP Address ranges for a a user.
- Update to the 7.x-3.x version and install field_ipaddress module.
- 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
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
Comment #4
smokrisComment #5
amateescu commentedClosing old issues.