• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't use $CI superobject in security class.

#1
[eluser]CMCDragonkai[/eluser]
If I try this MY_Security.php

Code:
$this->_CI =& get_instance();

It results in Fatal error: Class 'CI_Controller' not found in C:\...\system\core\CodeIgniter.php on line 210

According to this: http://ellislab.com/forums/viewthread/173303/#825774

My problem might be that the instance is not created when security.php is called.

Is there a workaround to this? I want to use the CI superobject and load a custom library into security.php.

#2
[eluser]CMCDragonkai[/eluser]
bump

#3
[eluser]Pedro Luz[/eluser]
Quote:My problem might be that the instance is not created when security.php is called.

i think the already exists... that is one of first things to be created.

how are u declaring that $_CI ??

private $_CI?
static _CI?

can we see a little bit more of the code?

#4
[eluser]Jelmer[/eluser]
The Security class is loaded by the Input class which is initialized before the Controller is loaded. The CI superobject is the controller and as such the superobject only comes into existance after the Security class was loaded.

To load a class anyway use either load_class() or just plain PHP include if you don't need it referenced on the CI superobject once that's created.

#5
[eluser]CMCDragonkai[/eluser]
Thanks,

I've decided to move the function out of the security class. It isn't worth the trouble to require CI in the security class.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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