CodeIgniter Forums

Full Version: Unable to locate the specified class: Session.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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]
Pre Controller will not work because CI has not loaded everything yet.
Session is still a library, until the new Session driver gets integrated into CI-develop
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
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.
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
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!
Actually, I just checked, and the session driver is installed. Sorry!
Let me take another look... you might have found a bug!
In config/autoload.php...
$autoload['drivers'] = array('session');
should work ... I just tried it.
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.
Pages: 1 2