summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-07-19 13:04:17 +0200
committerAndrey Andreev <narf@devilix.net>2016-07-19 13:04:17 +0200
commit9fd9248a2d712d5ae95bf2e6c6cd036e6b522cbb (patch)
tree07a175d72316b818e91150dd8f387993ce54274c
parent17fa8defc1b580df4395200f6536498918bc6ea6 (diff)
Fix #4679
-rw-r--r--system/core/Input.php4
-rw-r--r--tests/codeigniter/core/Input_test.php6
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 9 insertions, 2 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 50ca047e8..b81d51ebf 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -519,9 +519,9 @@ class CI_Input {
if ($separator === ':')
{
$netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
- for ($i = 0; $i < 8; $i++)
+ for ($j = 0; $j < 8; $j++)
{
- $netaddr[$i] = intval($netaddr[$i], 16);
+ $netaddr[$i] = intval($netaddr[$j], 16);
}
}
else
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index c56900d22..e1f4011b5 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -262,6 +262,12 @@ class Input_test extends CI_TestCase {
$this->assertEquals('FE80:0000:0000:0000:0202:B3FF:FE1E:8300', $this->input->ip_address());
$this->input->ip_address = FALSE;
+ $this->ci_set_config('proxy_ips', '0::/32');
+ $_SERVER['HTTP_CLIENT_IP'] = '127.0.0.7';
+ $_SERVER['REMOTE_ADDR'] = '0000:0000:0000:0000:0000:0000:0000:0001';
+ $this->assertEquals('127.0.0.7', $this->input->ip_address());
+
+ $this->input->ip_address = FALSE;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; // back to reality
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index d39900c67..ef8b5d6ce 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -40,6 +40,7 @@ Bug fixes for 3.0.7
- Fixed a bug (#4674) - :doc:`Database <database/index>` driver 'dblib' triggered E_WARNING messages while connecting.
- Fixed a bug (#4678) - :doc:`Database Forge <database/forge>` tried to use unsupported `IF NOT EXISTS` clause when creating tables on Oracle.
- Fixed a bug (#4691) - :doc:`File Uploading Library <libraries/file_uploading>` method ``data()`` returns wrong 'raw_name' when the filename extension is also contained in the raw filename.
+- Fixed a bug (#4679) - :doc:`Input Library <libraries/input>` method ``ip_address()`` errors with a matching ``$config['proxy_ips']`` IPv6 address.
Version 3.0.6
=============