• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Security class not autoloading loading (2.0.1)

#1
[eluser]arbme666[/eluser]
Hi,

I have been using this for a while and its suddenly stopped working and I can't figure out why. It is so an ajax request can get the CSRF token before submitting data.

Code:
class Csrf_token extends CI_Controller {

    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        $output['status'] = 'success';
        $output['csrf_token'] = $this->security->csrf_hash;
        
        print json_encode($output);
    }
}

I get the following errors:

Undefined property: Csrf_token::$security
Trying to get property of non-object

It seems to me the security class is not been loaded automatically anymore for some reason. If I add $this->load->library('security'); it works. Like I said its just started doing this for 1 of my projects the others are fine.

Should I just add it to the autoload or will this cause issues? Any ideas?

Thanks

#2
[eluser]InsiteFX[/eluser]
If you place this in your controller you can see what is loaded!
Code:
// Enable Profiler.
$this->output->enable_profiler(TRUE);

I think there was naming error on the CSRF code in one of the CI versions!

InsiteFX


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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