Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/107543
Change subject: Workaround ip2long limitation
......................................................................
Workaround ip2long limitation
* This was resulting in bogus queries that did ipblock table scans
bug: 60035
Change-Id: Id8f8846e002abcc0010c8706c664db86257786bf
---
M includes/utils/IP.php
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/43/107543/1
diff --git a/includes/utils/IP.php b/includes/utils/IP.php
index 2686e11..871f71b 100644
--- a/includes/utils/IP.php
+++ b/includes/utils/IP.php
@@ -489,6 +489,8 @@
if ( self::isIPv6( $ip ) ) {
$n = self::toUnsigned6( $ip );
} else {
+ // Bug 60035: an IP with leading 0's fails in ip2long
sometimes (e.g. *.08)
+ $ip = preg_replace( '/(?<=\.)0+(?=[1-9])/', '', $ip );
$n = ip2long( $ip );
if ( $n < 0 ) {
$n += pow( 2, 32 );
--
To view, visit https://gerrit.wikimedia.org/r/107543
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8f8846e002abcc0010c8706c664db86257786bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits