CodeIgniter Forums

Full Version: autoload libraries loaded in wrong order when enforcing .htaccess login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ipsod[/eluser]
I've got an .htaccess login setup on my development directory, and whenever it prompts for login, I get this error once the page loads:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: AdminHome::$ion_auth

Filename: core/Model.php

Line Number: 50


This is the code it's complaining about (note ion_auth is an autoloaded library):
Code:
class Admin_Controller extends MY_Controller {

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

        if( !$this->ion_auth->is_admin() )
        {
            redirect( 'login' );
        }
    }
}

This is in 2.0, and didn't happen in 1.7. It doesn't happen when I'm not prompted for login by .htaccess (and thus isn't a big deal). Bug, or no?

El Forum

[eluser]Ben Edmunds[/eluser]
Here is the temporary solution until we re-work Ion Auth to conform to this CI2.0 change:

https://bitbucket.org/ellislab/codeignit...when-using

El Forum

[eluser]ipsod[/eluser]
Thank you!

El Forum

[eluser]jmadsen[/eluser]
thank you from me, as well.

Time from finding unexplained error to finding posted solution: maybe 10 seconds?

Keep up the great support!