I am getting a fatal error in a CI app that I just moved from a php4 shared host to a php5 shared host.
Fatal error: Call to a member function set_userdata() on a non-object in /home/chuck_ravenna/bob.ravennainteractive.com/system/application/helpers/authenticate_helper.php on line 13
Code in full located in the link below
https://gist.github.com/1474173
I am trying to figure out if the php version could be the issue. The site runs fine on the old server, and the new server doesn't have php4 as an option.
The specific code line thats breaking is:
$this->session->set_userdata("admin", $user[0]["admin"]);
You can't use $this
inside a helper as a helper file is just a collection of functions (no class there). To use the functionality provided by $this
of controller, you'll have to do:
$ci = & get_instance();
$ci->session->set_userdata("admin", $user[0]["admin"]);