title: Codeigniter 3 - Session not working
body: <p>I have recently updated form 2.2.x to 3.0.0 with following the update procedure from codeigniter's <a href="http://www.codeigniter.com/userguide3/installation/upgrade_300.html" rel="nofollow noreferrer">website</a>.
  I have having real issues with the new session library - heres the issue.</p>
  
  <p>We have a login section which dependant on the subdomain and user/pass credentials will give you certain privileges from ADMIN / RESELLER / CLIENT / USER</p>
  
  <p>In order to determine the correct privileges for the user we have built a customer LIBRARY (location:application/library) which we have called Session_management, this library DOES NOT extend the core SESSION driver/library and never has and has no extension to another class, this library is also auto-loaded, prior to CI 3.0.0 everything was working fine.</p>
  
  <p>First this the Session_management does is __construct() </p>
  
  <pre><code>$this-&gt;CI =&amp; get_instance();
  $this-&gt;CI-&gt;load-&gt;model('users');
  $this-&gt;CI-&gt;load-&gt;model('clients');
  $this-&gt;CI-&gt;load-&gt;model('sessions');
  $this-&gt;CI-&gt;load-&gt;driver('session');
  $this-&gt;CI-&gt;load-&gt;library('password_hash');
  $this-&gt;CI-&gt;load-&gt;helper('url');
  
  $this-&gt;users = $this-&gt;CI-&gt;users;
  $this-&gt;clients = $this-&gt;CI-&gt;clients;
  $this-&gt;sessions = $this-&gt;CI-&gt;sessions;
  $this-&gt;session = $this-&gt;CI-&gt;session;
  $this-&gt;password_hash = $this-&gt;CI-&gt;password_hash;
  </code></pre>
  
  <p>Prior to CI 3.0.0 I has no issues in using the</p>
  
  <pre><code>$this-&gt;CI-&gt;load-&gt;library('session');
  </code></pre>
  
  <p>but for some unknown reason (to me) I HAVE to load it through the driver</p>
  
  <pre><code>$this-&gt;CI-&gt;load-&gt;diver('session');
  </code></pre>
  
  <p>if someone could explain why I am having to do it this way that would be great.</p>
  
  <p>When a user submits their user/pass credentials a CONTROLLER session/signin is requested which runs firstly form validation, providing everything is successfully, the Session_management login method is called.</p>
  
  <pre><code>$success = $this-&gt;session_management-&gt;login
    ($this-&gt;input-&gt;post('email'), $this-&gt;input-&gt;post('password'));
  </code></pre>
  
  <p>In the LOGIN method in the Session_management class a bunch of sessions are set using </p>
  
  <pre><code>$this-&gt;session-&gt;set_userdata();
  
  $this-&gt;session-&gt;set_userdata('user_id', 0);
  $this-&gt;session-&gt;set_userdata('user_name', '');
  $this-&gt;session-&gt;set_userdata('client_id', 0);
  $this-&gt;session-&gt;set_userdata('client_administrator', 0);
  $this-&gt;session-&gt;set_userdata('reseller_administrator', 0);
  </code></pre>
  
  <p>However when I var_dump() the session for all its session data it has NOTHING and I can't why this is, no session data is there except my protected fields form the config, which I have double checked and triple checked and are working fine, my sess_save_path is storing the session files correctly, and the rest of the sess configs are also correct.</p>
  
  <pre><code>$config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_expiration'] = 7200;
  $config['sess_save_path'] = '/Users/******/Sites/********/tmp';
  $config['sess_match_ip'] = FALSE;
  $config['sess_time_to_update'] = 300;
  $config['sess_regenerate_destroy'] = FALSE;
  </code></pre>
  
  <p>This is a development website on my local OS X iMac, as I say prior to CI 3.0.0 everything was working fine.</p>
  
  <p>Just to add before I get reply's saying "you need to use"</p>
  
  <pre><code>$this-&gt;load-&gt;library('session');
  </code></pre>
  
  <p>I have "HAD" to load it as a driver, I don't have a choice, I have read the documentation and have seen how to initialise the session <a href="http://www.codeigniter.com/userguide3/libraries/sessions.html#initializing-a-session" rel="nofollow noreferrer">library</a>. </p>
  
  <p>If I do attempt to load it as a library</p>
  
  <pre><code>$this-&gt;load-&gt;library('session');
  </code></pre>
  
  <p>This is what I get</p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  Message: Undefined property: Session::$session
  Filename: libraries/Session_management.php
  Line Number: 38
  </code></pre>
  
  <p>For your ref: line 38 is:</p>
  
  <pre><code>$this-&gt;session = $this-&gt;CI-&gt;session;
  </code></pre>
  
  <p>This is after trying to load the session library</p>
  
  <pre><code>$this-&gt;CI-&gt;load-&gt;library('session');
  </code></pre>
  
  <p>Also to add to this message re: Database sessions / File session.
  Database sessions were my first option, a have revamp the database columns and indexes to suit CI 3.0.0 as the documentation mentions and session were and are storing in the database table when I change my config to use the database, however reading the performance differences between File sessions against Database sessions under high load, File sessions will out perform database session and since the website / platform I am creating will be under high load, database sessions aren't the way forward.</p>
  
  <p>As a note: The website runs under a subdomain.domain.*** structure where subdomain is registered as a company name upon a company registration i.e</p>
  
  <pre><code>mycompany.mywebsiteurl.com
  anothercompany.mywebsiteurl.com
  </code></pre>
  
  <p>As previously mention - prior to my update to CI 3.0.0 it was working fine.</p>
  
  <p>Might I also add: I have checked my log files, I am running tail -f for live log updates - and it don't see any log issues.</p>
  
  <p>Any help, information or anything that could possible put me in the right direction would be appreciated.</p>
  
  <p>I have also <a href="http://forum.codeigniter.com/thread-62262.html" rel="nofollow noreferrer">posted on the CI forum</a>.</p>