Welcome Guest, Not a member yet? Register   Sign In
Upgrade 1.7.2 -> 2.0.2: trying to load the constructor brings up a blank page, no errors shown (SOLVED)
#1

[eluser]LeonardoGaiero[/eluser]
Greetings. I'm having some problems upgrading a CodeIgniter app from 1.7.2 to 2.0.2: whenever I try to load the constructor with parent::__construct(), the application cryptically shows a blank page, which I can't debug; nothing's showing up in the logfiles as well. I changed code references to CI_Model and CI_Controller, added the __construct function to the config file, all to no avail. As an example, here's how my controller looks like:

Code:
<?PHP

class First extends CI_Controller {
    var $_session    = array('user' => '',
                'role' => ''
                );
            
    function First() { // Costruttore
        parent::__construct();
        exit('test');
        $this->load->helper('url');
        $this->session->unset_userdata($this->_session);    
}
...
With the code like this, absolutely nothing shows up; however, removing the parent::__construct(); line exits as expected, but of course then the application is unusable. Any ideas on how I could fix this? Thanks in advance.
#2

[eluser]davidbehler[/eluser]
Your constructor should look like this:

Code:
function __construct() {
  parent::__construct();
  exit('test');
  $this->load->helper('url');
  $this->session->unset_userdata($this->_session);
}
#3

[eluser]LeonardoGaiero[/eluser]
[quote author="waldmeister" date="1304347588"]Your constructor should look like this:

Code:
function __construct() {
  parent::__construct();
  exit('test');
  $this->load->helper('url');
  $this->session->unset_userdata($this->_session);
}
[/quote]
Thanks for the fast response. I just tried that, however nothing changes, as it still fails; as a test, I tried pasting the constructor over to the controller in the builtin demo application, and it exits properly when tried from there. Could there be anything else that needs to be tuned?

[EDIT] After some progress, I figured out that the error actually lies in my server's configuration: since I migrated to an entirely new environment, I forgot to properly configure PHP to connect to MySQL, and that's pretty much where it chokes. Thanks either way for your suggestion, it came in handy.




Theme © iAndrew 2016 - Forum software by © MyBB