Automatic IPv6 detection while converting long to IP #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to ip2long() function being able to handle both v4 and v6 addresses, it takes another step for the developer to save information about IP address, for it being decoded by long2ip.
Max long value coming from ipv4 -> 255.255.255.255 is 4294967295 (32bit max integer).
Smallest ipv6 address is 2000:: -> 42535295865117307932921825928971026432.
So it is safe to use this condition.
Additionally odd behaviour is about ::1 returning 1, while 127.0.0.1 is 2130706433.
:: returns 0.