Merge pull request #1438 from IT-Can/form-helper-fix

Form helper fixes for issues triggered by 773ccc318f2769c9b7579630569b5d8ba47b114b
diff --git a/system/core/Input.php b/system/core/Input.php
index 73f46ba..b986c49 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -383,7 +383,7 @@
 	 */
 	public function valid_ip($ip)
 	{
-		return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
+		return (bool) filter_var($ip, FILTER_VALIDATE_IP);
 	}
 
 	// --------------------------------------------------------------------
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 0f8404d..06b68db 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -247,7 +247,7 @@
 			{
 				foreach ($args[0] as $key => $val)
 				{
-					$args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val);
+					$ret_args[$key] = (is_array($val) && isset($val['data'])) ? $val : array('data' => $val);
 				}
 			}
 		}
@@ -257,12 +257,12 @@
 			{
 				if ( ! is_array($val))
 				{
-					$args[$key] = array('data' => $val);
+					$ret_args[$key] = array('data' => $val);
 				}
 			}
 		}
 
-		return $args;
+		return $ret_args;
 	}
 
 	// --------------------------------------------------------------------
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index cfc80c9..c9322c0 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -143,4 +143,19 @@
 		$this->assertEquals("Hello, i try to <script>alert('Hack');</script> your site", $harm);
 		$this->assertEquals("Hello, i try to [removed]alert&#40;'Hack'&#41;;[removed] your site", $harmless);
 	}
+
+	// --------------------------------------------------------------------
+	
+	public function test_valid_ip()
+	{
+		$ip_v4 = '192.18.0.1';
+		$this->assertTrue($this->input->valid_ip($ip_v4));
+
+		$ip_v6 = array('2001:0db8:0000:85a3:0000:0000:ac1f:8001', '2001:db8:0:85a3:0:0:ac1f:8001', '2001:db8:0:85a3::ac1f:8001');
+		foreach($ip_v6 as $ip)
+		{
+			$this->assertTrue($this->input->valid_ip($ip));
+		}
+	}
+
 }
\ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index ce9b068..211e9ac 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -135,6 +135,7 @@
    -  Allowed for setting table class defaults in a config file.
    -  Added a Wincache driver to the :doc:`Caching Library <libraries/caching>`.
    -  Added dsn (delivery status notification) option to the :doc:`Email Library <libraries/email>`.
+   -  Input library now supports IPv6.
    -  Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library <libraries/email>`.
 
 -  Core
@@ -232,6 +233,7 @@
 -  Fixed a bug (#1411) - the :doc:`Email library <libraries/email>` used its own short list of MIMEs instead the one from config/mimes.php.
 -  Fixed a bug where the magic_quotes_runtime setting wasn't turned off for PHP 5.3 (where it is indeed deprecated, but not non-existent).
 -  Fixed a bug (#666) - :doc:`Output library <libraries/output>`'s set_content_type() method didn't set the document charset.
+-  Fixed a bug (#1374) - :doc:`Table Library <libraries/table>` was generating an extra td tag at the start of the tr.
 
 Version 2.1.1
 =============