Disable Session library under CLI and create a CI singleton to be used by its drivers
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index e6f6050..9785060 100755
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -69,13 +69,21 @@
* routines in its constructor, and manages flashdata aging.
*
* @param array Configuration parameters
+ * @return void
*/
public function __construct(array $params = array())
{
+ $CI =& get_instance();
+
+ // No sessions under CLI
+ if ($CI->input->is_cli_request())
+ {
+ return;
+ }
+
log_message('debug', 'CI_Session Class Initialized');
// Get valid drivers list
- $CI =& get_instance();
$this->valid_drivers = array(
'Session_native',
'Session_cookie'
@@ -587,6 +595,23 @@
*/
abstract class CI_Session_driver extends CI_Driver {
+ protected $CI;
+
+ /**
+ * Constructor
+ *
+ * Gets the CI singleton, so that individual drivers
+ * don't have to do it separately.
+ *
+ * @return void
+ */
+ public function __construct()
+ {
+ $this->CI =& get_instance();
+ }
+
+ // ------------------------------------------------------------------------
+
/**
* Decorate
*