CodeIgniter Forums
CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 (/showthread.php?tid=56943)

Pages: 1 2


CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-02-2013

[eluser]InsiteFX[/eluser]
Dont forget to change your Constructors to the new ones also.
Code:
//old way
class MyClass {

    function MyClass()
    {

    }
}

// New way constructor
class MyClass {

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



CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-02-2013

[eluser]tdegryse[/eluser]
Thanks for the update, I'm looking into all my constructor files now.

I saw your comment on another problem on this forum where you said that the library extensions come in the library folder correct? I have 3 extended classes, MY_Session, MY_Email and MY_Security and they are in the application/libraries folder. Just want to confirm this is correct.

Also I noticed that in my system/core/codeigniter.php around line 220 there's following code

Code:
require BASEPATH.'core/Controller'.EXT;
function &get;_instance()
{
  return CI_Controller::get_instance();
}

When I move the 'require ..' line to the top of my page I dont get the ci_controller error anymore. Now I get Fatal error: Call to undefined method CI_Security::SetLastPage()

It seems like anything I change keeps switching between these two error messages.


CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-02-2013

[eluser]tdegryse[/eluser]
BTW MY_Security looks like this

Code:
class MY_Security extends CI_Security{

private $CI = null;

// TODO: ensure it's admin/user safe

/**
  * __construct()
  *
  * Constructor
  * Load the classes
  *
  * @access public
  * @param none
  * @return void
  */
public function __construct()
{
  $this->CI =& get_instance();
  
  $this->CI->load->library('encrypt');
  $this->CI->load->library('validation');
}

I get a Call to a member function library() on a non-object on the load library line


CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-02-2013

[eluser]Aken[/eluser]
You won't be able to use get_instance() in your extended Security file, because it is loaded before the controller exists (which is what the function is looking for, and why the error comes from that line of CodeIgniter.php).


CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-02-2013

[eluser]InsiteFX[/eluser]
Code:
public function __construct()
{
    // you need to add this when extending all CI core/libraries.
     parent::__construct();
}

Also Aken is correct you cannot use get_instance, because CI is not loaded yet.



CI update from 1.7 to 2.0 getting Fatal error: Class 'CI_Controller' not found in CodeIgniter.php on line 210 - El Forum - 02-05-2013

[eluser]tdegryse[/eluser]
After a couple of days of changing code and trying things I've got the front page displaying correctly. However the other pages won't come up and return a 404. I think it's the routing..

Anyhow thanks a lot for your help,
Toon