summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Input.php19
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/libraries/input.rst6
3 files changed, 9 insertions, 18 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 11b2e94e0..d1353e9dc 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -156,32 +156,23 @@ class CI_Input {
*/
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
{
- // If $index is NULL, it means that the whole $array is requested
- if ($index === NULL)
- {
- $output = array();
- foreach (array_keys($array) as $key)
- {
- $output[$key] = $this->_fetch_from_array($array, $key, $xss_clean);
- }
+ is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
- return $output;
- }
+ // If $index is NULL, it means that the whole $array is requested
+ isset($index) OR $index = array_keys($array);
// allow fetching multiple keys at once
if (is_array($index))
{
$output = array();
- foreach ($index as $var)
+ foreach (array_keys($array) as $key)
{
- $output[$var] = $this->_fetch_from_array($array, $var, $xss_clean);
+ $output[$key] = $this->_fetch_from_array($array, $key, $xss_clean);
}
return $output;
}
- is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
-
if (isset($array[$index]))
{
$value = $array[$index];
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 711120a6b..f01ff8a5d 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -473,7 +473,7 @@ Release Date: Not Released
- Changed default value of the ``$xss_clean`` parameter to NULL for all methods that utilize it, the default value is now determined by the ``$config['global_xss_filtering']`` setting.
- Added method ``post_get()`` and changed ``get_post()`` to search in GET data first. Both methods' names now properly match their GET/POST data search priorities.
- Changed method ``_fetch_from_array()`` to parse array notation in field name.
- - Changed method ``_fetch_from_array()`` to allow retrieving multiple fields at once by passing $index as an array.
+ - Changed method ``_fetch_from_array()`` to allow retrieving multiple fields at once.
- Added an option for ``_clean_input_keys()`` to return FALSE instead of terminating the whole script.
- Deprecated the ``is_cli_request()`` method, it is now an alias for the new :func:`is_cli()` common function.
- Added an ``$xss_clean`` parameter to method ``user_agent()`` and removed the ``$user_agent`` property.
diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst
index 4df7629e4..112347129 100644
--- a/user_guide_src/source/libraries/input.rst
+++ b/user_guide_src/source/libraries/input.rst
@@ -208,7 +208,7 @@ Class Reference
.. method:: cookie([$index = NULL[, $xss_clean = NULL]])
- :param mixed $index: COOKIE parameter name
+ :param mixed $index: COOKIE name
:param bool $xss_clean: Whether to apply XSS filtering
:returns: $_COOKIE if no parameters supplied, otherwise the COOKIE value if found or NULL if not
:rtype: mixed
@@ -219,7 +219,7 @@ Class Reference
$this->input->cookie('some_cookie');
$this->input->cookie('some_cookie, TRUE); // with XSS filter
- To return an array of multiple cookie parameters, pass all the required keys
+ To return an array of multiple cookie values, pass all the required keys
as an array.
::
$this->input->cookie(array('some_cookie', 'some_cookie2'));
@@ -236,7 +236,7 @@ Class Reference
$this->input->server('some_data');
- To return an array of multiple server parameters, pass all the required keys
+ To return an array of multiple ``$_SERVER`` values, pass all the required keys
as an array.
::
$this->input->server(array('SERVER_PROTOCOL', 'REQUEST_URI'));