Welcome Guest, Not a member yet? Register   Sign In
libraries not loading from controller methods
#1

[eluser]Jack Scott[/eluser]
I'm having trouble loading libraries from controller methods in PHP 5.2.6 under Mac OS 10.5.6. Library loading seems to work ok in PHP 4.3.9.

I was able to recreate this problem with an unmodified copy of CI 1.7.1.

Inside system/application/controllers/welcome.php, at the top of the index() method, I added the code:

$this->load->library('form_validation');
print_r($this->form_validation);

Under PHP 5.2.6, I see the error message "Undefined property: Welcome::$form_validation". Trying to access any variable or method under $this->form_validation results in a fatal error. The code works as expected if I move $this->load->library() to the constructor. It also works as expected if I move both lines to the constructor.

The code also works as expected under PHP 4.3.9 under Linux.

Has anyone encountered this before? Is it a CI bug, a PHP5 weirdness, or something strange in Mac OS X's PHP?

Jack


Messages In This Thread
libraries not loading from controller methods - by El Forum - 04-05-2009, 08:33 PM
libraries not loading from controller methods - by El Forum - 04-06-2009, 09:11 AM
libraries not loading from controller methods - by El Forum - 05-29-2009, 09:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB