Remote_ip_long Format IPv6

Good morning,
I met a new difficulty with your extension, I tried to reset and import all data today, and I see Ip in format IPv6 caused an error ouput and is not supported.
What is the best solution to solve this issue ?
So far, we have set to ‘121.0.0.7’ this field in our old database.
Ilan

4 answers

Profile photo of Mall Staff 184060.00 $tone November 7, 2017
Public

Hi there,

I tried to reset and import all data today, and I see Ip in format IPv6 caused an error ouput and is not supported.

Seem you got that issue in the step #8 of our tool? The ‘remote_ip_long’ in table ‘rating_option_vote’ was changed data type from varbinary -> bigint in Magento2 database structure.
and our tool has reupdate value of this field from value of the remote_ip field.

$model2->remote_ip_long = ip2long($model->remote_ip);

What is version of our tool in your working now?
Kindly provide me the admin credentials, ssh credentials and web root path of your instance. I will check further and reply you more later.
Regards,
Mall.

#1
Profile photo of artbambou 70.00 $tone November 7, 2017
Public

Good morning,
Unfortunatly, I can not give you access to our sFTP, only our back-office.
I just checked the function ip2long

ip2long — Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer
http://php.net/manual/en/function.ip2long.php

Example of output :

// Our Example IP’s
$ip4= “10.22.99.129”;
$ip6= “fe80:1:2:3:a:bad:1dea:dad”;
var_dump( ip2long($ip4) ); // int(169239425)
var_dump( ip2long($ip6) ); // bool(false)

They recommand to use inet_ntop()
But it would translate it in a binary string but Magento 2 use a bigint field for storage this data.
Ilan

#2
Profile photo of Mall Staff 184060.00 $tone November 7, 2017
Public

Hi there,

…. but Magento 2 use a bigint field for storage this data.

Yes, that is right. To clear more, you could view more core code files of Magento2 at:
vendor/magento/module-review/Setup/InstallSchema.php
vendor/magento/module-review/Model/ResourceModel/Rating/Option.php
vendor/magento/framework/HTTP/PhpEnvironment/RemoteAddress.php
To solve that, you must convert all ip_v6 values of the remote_ip field in table rating_option_vote in your Magento1’s databse first.
Once done, you could continue with data migration in the step #8 of our tool.
Regards,
Mall.
 

#4

Please login or Register to Submit Answer

Written By

Comments