IP address regexp is not good enough
dmitryd opened this issue · comments
The security fix in 5.1.2 introduced a regexp to "fix" ip addresses. However it will corrupt IPv6 addresses:
$ php -a
Interactive shell
php > echo preg_replace('~[^0-9\.]~', '', '2001:0db8:85a3:0000:0000:8a2e:0370:7334');
200108853000000008203707334
At least there should be a colon added to the regexp.
Another issue that IPv6 is not supported at all here because of inet_aton
is IPv4 only :(
Thx for your issue. We know that the regex is optimized for IPv4 only. That's because at the moment there are only IPv4 addresses stored in the related table tx_ipandlanguageredirect_domain_model_iptocountry
So, it is a missing feature to also provide a "IPv6 to Country mapping table" at the moment.