• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate the specified class: Session.php

#1
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]
Reply

#2
Pre Controller will not work because CI has not loaded everything yet.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

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

#4
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
Reply

#5
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.
Reply

#6
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
Reply

#7
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!
Reply

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

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

#10
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.