[Typo3-dev] IPv6 integration for Typo3

Martin T. Kutschker Martin.no5pam.Kutschker at blackbox.n0spam.net
Mon Sep 20 10:45:38 CEST 2004


Sven Wilhelm wrote:
> Hi Marting,
> 
>> Sven, I think a simple split/count check would be faster, or at least 
>> easier to read then this regexp.
> 
> Don't know if that really works well with v6.
> Examples for valid addresses(the easiest):
> 
> FEDC:BA98:7654:3210:FEDC:BA98:7654:3210
> FEDC:BA98::3210:FEDC:BA98:7654:3210
> FEDC:BA98::7654:3210
> FEDC::7654:3210
> ::7654:3210
> 1080:0:0:0:8:800:200C:417A
> FF01:0:0:0:0:0:0:101
> 0:0:0:0:0:0:0:1
> 0:0:0:0:0:0:0:0
> 1080::8:800:200C:417A
> FF01::101
> ::1

I know. But what are the not so easy examples.

> The regex is only dirty to read on that site.

No. It's just the same. I like regexps but IMHO this is not a task for them.

BTW, simply validating is not enough for "IPv6-support". We need a way 
to compare IPv6 addresses, so I think we need a function that 
"normalizes" an IPv6 addresses. As a side effect it does a validation: 
if it cannot be normalized, it's invalid.

Normalizing means filling up all 8 blocks with numbers, possibly padding 
them with leading zeroes.

If we can do this than t3lib_div::cmpIP() can be enhanced to support 
IPv6 addresses.

Masi




More information about the TYPO3-dev mailing list