diff options
author | Marek A. RuszczyĆski <aptx@phpbb.com> | 2010-04-09 14:08:20 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-05-16 18:36:21 +0200 |
commit | 1d2b4ffc651bc1f39849c643e69193926611f2ec (patch) | |
tree | b68dfd1b08b6087c7bf4e31cc6e0f23a60e4445f | |
parent | d62068cfadcc1478a2f8dd6e7da81dea6cee71ff (diff) | |
download | forums-1d2b4ffc651bc1f39849c643e69193926611f2ec.tar forums-1d2b4ffc651bc1f39849c643e69193926611f2ec.tar.gz forums-1d2b4ffc651bc1f39849c643e69193926611f2ec.tar.bz2 forums-1d2b4ffc651bc1f39849c643e69193926611f2ec.tar.xz forums-1d2b4ffc651bc1f39849c643e69193926611f2ec.zip |
[ticket/9524] IPv6 regex does not match all valid IPv6 addresses starting with ::
:: can replace 1 or more groups (not 2 or more)
PHPBB3-9524
-rw-r--r-- | phpBB/develop/regex.php | 5 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/phpBB/develop/regex.php b/phpBB/develop/regex.php index 4498204b4a..8165ba1f21 100644 --- a/phpBB/develop/regex.php +++ b/phpBB/develop/regex.php @@ -18,14 +18,15 @@ $ls32 = "(?:$h16:$h16|$ipv4)"; $ipv6_construct = array( array(false, '', '{6}', $ls32), - array(false, '::', '{5}', $ls32), + array(false, '::', '{0,5}', "(?:$h16(?::$h16)?|$ipv4)"), array('', ':', '{4}', $ls32), array('{1,2}', ':', '{3}', $ls32), array('{1,3}', ':', '{2}', $ls32), array('{1,4}', ':', '', $ls32), array('{1,5}', ':', false, $ls32), array('{1,6}', ':', false, $h16), - array('{1,7}', ':', false, '') + array('{1,7}', ':', false, ''), + array(false, '::', false, '') ); $ipv6 = '(?:'; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 38f910974a..e8f45b654f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3332,7 +3332,7 @@ function get_preg_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