dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6b57dc6
)
Take the IPv4 part of mapped addresses rather than broken '.'->':' replace
author
Aaron Schulz
<aaron@users.mediawiki.org>
Sat, 8 Aug 2009 01:22:15 +0000
(
01:22
+0000)
committer
Aaron Schulz
<aaron@users.mediawiki.org>
Sat, 8 Aug 2009 01:22:15 +0000
(
01:22
+0000)
includes/IP.php
patch
|
blob
|
history
diff --git
a/includes/IP.php
b/includes/IP.php
index
d5c61d2
..
c20ebcd
100644
(file)
--- a/
includes/IP.php
+++ b/
includes/IP.php
@@
-541,11
+541,10
@@
class IP {
if ( self::isValid( $addr ) )
return $addr;
- //
Annoying IPv6 representations like ::ffff:
1.2.3.4
+ //
Turn mapped addresses from ::ce:ffff:1.2.3.4 to
1.2.3.4
if ( strpos($addr,':') !==false && strpos($addr,'.') !==false ) {
- $addr = str_replace( '.', ':', $addr );
- if( IP::isIPv6( $addr ) )
- return $addr;
+ $addr = substr( $addr, strrpos($addr,':')+1 );
+ if( self::isIPv4($addr) ) return $addr;
}
// IPv6 loopback address