Steffen
Well-known member
- Affected version
- 2.0.0 Beta 7
Take the IPv4 address 192.168.123.123. XenForo internally stores it as an IPv4-mapped IPv6 address which totally makes sense. But when displaying this IP address, XenForo formats it as "::ffff:c0a8:7b7b" which is technically correct but I dont' think it's very user-friendly. In fact, XenForo is the only software I know that does not simply format such addresses as "::ffff:192.168.123.123".
Wikipedia agrees: "These addresses are typically written with a 96-bit prefix in the standard IPv6 format, and the remaining 32 bits written in the customary dot-decimal notation of IPv4." – https://en.wikipedia.org/wiki/IPv6#IPv6_readiness
In fact, the built-in PHP function inet_ntop uses this user-friendly formatting automatically. I'm wondering why "XF\Util\Ip" implements a custom "convertIpBinaryToString" method instead of using the native PHP function? Is it because some arcane PHP installations might not have IPv6 support?
(The dual method "convertIpStringToBinary" could be replaced by inet_pton.)
Wikipedia agrees: "These addresses are typically written with a 96-bit prefix in the standard IPv6 format, and the remaining 32 bits written in the customary dot-decimal notation of IPv4." – https://en.wikipedia.org/wiki/IPv6#IPv6_readiness
In fact, the built-in PHP function inet_ntop uses this user-friendly formatting automatically. I'm wondering why "XF\Util\Ip" implements a custom "convertIpBinaryToString" method instead of using the native PHP function? Is it because some arcane PHP installations might not have IPv6 support?
(The dual method "convertIpStringToBinary" could be replaced by inet_pton.)