Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix CI_Input::get() and CI_Input::post() not returning array when a k…

…ey is not specified
  • Loading branch information...
commit 77bd21b15305412b63c8f448787d5b275efd07e2 1 parent a2b0677
Andrey Andreev narfbg authored

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. +12 2 system/core/Input.php
14 system/core/Input.php
@@ -178,8 +178,13 @@ protected function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
178 178 public function get($index = NULL, $xss_clean = FALSE)
179 179 {
180 180 // Check if a field has been provided
181   - if ($index === NULL && ! empty($_GET))
  181 + if ($index === NULL)
182 182 {
  183 + if (empty($_GET))
  184 + {
  185 + return array();
  186 + }
  187 +
183 188 $get = array();
184 189
185 190 // loop through the full _GET array
@@ -205,8 +210,13 @@ public function get($index = NULL, $xss_clean = FALSE)
205 210 public function post($index = NULL, $xss_clean = FALSE)
206 211 {
207 212 // Check if a field has been provided
208   - if ($index === NULL && ! empty($_POST))
  213 + if ($index === NULL)
209 214 {
  215 + if (empty($_POST))
  216 + {
  217 + return array();
  218 + }
  219 +
210 220 $post = array();
211 221
212 222 // Loop through the full _POST array and return it

0 comments on commit 77bd21b

Please sign in to comment.
Something went wrong with that request. Please try again.