• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved]Custom Library Load Failure

#1
[eluser]ner0tic[/eluser]
I'm having an issue with my library not autoloading.

the file is called Scssauth.php and it's in system/application/libraries

i've added Scssauth to autoload['libraries'] in my config file

here is the first few lines of the library:
Code:
<?php  
    if (!defined('BASEPATH')) exit('No direct script access allowed');

    class Scssauth {
        var $obj;
        var $a_users = array();
        var $d_users = array();
        var $a_set = false;
        var $d_set = false;
        var $acl_denied = 'You are not permitted to view this page.';
        
        function __construct() {
            $this->obj =& get_instance();
            $this->obj->load->database();
            log_message('debug','Scssauth :: initialized => '.get_class($this->obj));
        } // end function Auth()
            
        function Scssauth() {
            $this->obj =& get_instance();
            $this->obj->load->database();
            log_message('debug','Scssauth :: initialized => '.get_class($this->obj));
        } // end function Scssauth()

This is the error from the CI logs:
Code:
DEBUG - 2009-01-20 16:06:13 --> Config Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Hooks Class Initialized
DEBUG - 2009-01-20 16:06:13 --> URI Class Initialized
DEBUG - 2009-01-20 16:06:13 --> No URI present. Default controller set.
DEBUG - 2009-01-20 16:06:13 --> Router Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Output Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Input Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Global POST and COOKIE data sanitized
DEBUG - 2009-01-20 16:06:13 --> Language Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Loader Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: url_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: form_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: date_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: cookie_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: directory_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: text_helper
DEBUG - 2009-01-20 16:06:13 --> Helper loaded: snappy_source_helper
DEBUG - 2009-01-20 16:06:13 --> Database Driver Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Application Session (Native) Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Email Class Initialized
DEBUG - 2009-01-20 16:06:13 --> Validation Class Initialized
DEBUG - 2009-01-20 16:06:13 --> User Agent Class Initialized
ERROR - 2009-01-20 16:06:13 --> Unable to load the requested class: scssauth

#2
[eluser]therealmaloy[/eluser]
ner0tic

try removing the

Code:
function __construct(){...}


let us know your progress Smile

#3
[eluser]ner0tic[/eluser]
no dice.

I added that in attempt to fix it for php5. same error. very non descript

#4
[eluser]ner0tic[/eluser]
I commented out all my code in my library except the constructor and it still fails

#5
[eluser]ner0tic[/eluser]
solved.

i was calling the function from my autoload while capitalizing the first letter like the filename.

#6
[eluser]therealmaloy[/eluser]
ner0tic

ahhh... strange on my case, i was able to run with same configuration with yours Smile

strange indeed but this works for me, i've changed $this->obj to $this->CI as to be consistent with general codes out there Smile

What I did was put another method (function testtest(){...}) instead of just the constructor(s) in the class.

example 1...(Library)
Code:
<?php
    if (!defined('BASEPATH')) exit('No direct script access allowed');

    class Scssauth {
        var $CI;
        var $a_users = array();
        var $d_users = array();
        var $a_set = false;
        var $d_set = false;
        var $acl_denied = 'You are not permitted to view this page.';
        
        function Scssauth() {
            $this->CI =& get_instance();
            $this->CI->load->database();
            log_message('debug','Scssauth :: initialized => '.get_class($this->CI));
              return;
        } // end function Scssauth()

         function testtest()
        {
               $this->CI->output->set_output('testing');
            return;
        }
}

example 1...(Controller)
Code:
$this->scssauth->testtest();


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.