summaryrefslogtreecommitdiffstats
path: root/system/core/Input.php
diff options
context:
space:
mode:
authorMaster Yoda <jim_parry@bcit.ca>2015-03-07 01:09:48 +0100
committerMaster Yoda <jim_parry@bcit.ca>2015-03-07 01:09:48 +0100
commitd46085b99398b08c8620fdcefd8cf0e88408147d (patch)
tree939d3c0e26f1aaa8ead59e6a88e592f3ea9b3faa /system/core/Input.php
parent7762c59b50b39f00660c820171a647ea6935a93e (diff)
parent3b526f46f5f28bc15a3402a895538777056cc9f3 (diff)
Merge branch 'develop' of https://github.com/bcit-ci/CodeIgniter into fix/housekeeping
Diffstat (limited to 'system/core/Input.php')
-rw-r--r--system/core/Input.php46
1 files changed, 42 insertions, 4 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index fae3b6c08..6be4b9a6c 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -55,7 +55,7 @@ class CI_Input {
*
* @var string
*/
- public $ip_address = FALSE;
+ protected $ip_address = FALSE;
/**
* Allow GET array flag
@@ -104,14 +104,28 @@ class CI_Input {
protected $headers = array();
/**
- * Input stream data
+ * Raw input stream data
+ *
+ * Holds a cache of php://input contents
+ *
+ * @var string
+ */
+ protected $_raw_input_stream;
+
+ /**
+ * Parsed input stream data
*
* Parsed from php://input at runtime
*
* @see CI_Input::input_stream()
* @var array
*/
- protected $_input_stream = NULL;
+ protected $_input_stream;
+
+ protected $security;
+ protected $uni;
+
+ // --------------------------------------------------------------------
/**
* Class constructor
@@ -313,7 +327,8 @@ class CI_Input {
// so we'll need to check if we have already done that first.
if ( ! is_array($this->_input_stream))
{
- parse_str(file_get_contents('php://input'), $this->_input_stream);
+ // $this->raw_input_stream will trigger __get().
+ parse_str($this->raw_input_stream, $this->_input_stream);
is_array($this->_input_stream) OR $this->_input_stream = array();
}
@@ -846,4 +861,27 @@ class CI_Input {
: strtolower($this->server('REQUEST_METHOD'));
}
+ // ------------------------------------------------------------------------
+
+ /**
+ * Magic __get()
+ *
+ * Allows read access to protected properties
+ *
+ * @param string $name
+ * @return mixed
+ */
+ public function __get($name)
+ {
+ if ($name === 'raw_input_stream')
+ {
+ isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input');
+ return $this->_raw_input_stream;
+ }
+ elseif ($name === 'ip_address')
+ {
+ return $this->ip_address;
+ }
+ }
+
}