CodeIgniter Forums
Unable to locate the specified class: Session.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Unable to locate the specified class: Session.php (/thread-210.html)

Pages: 1 2


Unable to locate the specified class: Session.php - agriz - 11-11-2014

I created a pre_controller hook

Code:
public function __construct() {
        parent::__construct();
        $this->load->driver('session');
    }

it is not working and shows error.
Unable to locate the specified class: Session.php[/code]


RE: Unable to locate the specified class: Session.php - InsiteFX - 11-11-2014

Pre Controller will not work because CI has not loaded everything yet.


RE: Unable to locate the specified class: Session.php - ciadmin - 11-11-2014

Session is still a library, until the new Session driver gets integrated into CI-develop


RE: Unable to locate the specified class: Session.php - agriz - 11-11-2014

Code:
autoload.php
$autoload['drivers'] = array('session');

hooks.php
$hook['post_controller_constructor'] = array(

post controller constructor
$this->session->set_userdata(..

another controller (Home.php)
print_r($this->session->userdata());

I am still getting the same error


RE: Unable to locate the specified class: Session.php - ciadmin - 11-11-2014

My earlier reply says that the Session is still a class, until the new driver is complete.

This means that instead of
$autoload['drivers'] = array('session');
you need
$autoload['libraries'] = array('session');

This will change at some point, but it is how you use the session at the moment.


RE: Unable to locate the specified class: Session.php - agriz - 11-11-2014

I am sorry. In 3.0
i saw this following line

Code:
| Prototype:
|
|    $autoload['drivers'] = array('session', 'cache');

That is why i was using drivers.

In doc,

Code:
To initialize the Session class manually in your controller constructor, use the $this->load->driver function:

$this->load->driver('session');
Once loaded, the Sessions library object will be available using:

$this->session

So, should i use $this->load->library('session'); ?

I disabled hooks.
autoloaded session library.

Code:
Fatal error: Class 'CI_Driver_Library' not found in C:\codeigniter\system\libraries\Session\Session.php on line 64



RE: Unable to locate the specified class: Session.php - ciadmin - 11-12-2014

For NOW, yes you have to use library('session')

Once the new session driver is incorporated, you will use driver('session').

The code changes are not quite completd, but the documentation has already been updated.

Confusing, sorry!


RE: Unable to locate the specified class: Session.php - ciadmin - 11-12-2014

Actually, I just checked, and the session driver is installed. Sorry!
Let me take another look... you might have found a bug!


RE: Unable to locate the specified class: Session.php - ciadmin - 11-12-2014

In config/autoload.php...
$autoload['drivers'] = array('session');
should work ... I just tried it.


RE: Unable to locate the specified class: Session.php - agriz - 11-12-2014

I enabled session is autoload (drivers)
I disabled all my hooks. Session is working good.

Now, I have enabled my post_constroller_construction hook

Code:
$data = array(
            'u' => 'test'
        );
        
        $this->session->set_userdata($data);

Throws error

Code:
Unable to locate the specified class: Session.php
Nothing loaded after this line.