Welcome Guest, Not a member yet? Register   Sign In
Assigning a library a different object name, while in a library, while extending... results in error.
#1

[eluser]CMCDragonkai[/eluser]
I have a controller loading base_library.

Code:
$this->load->library('base_library');

The base library loads test_library but assigns it a different object name.

Code:
$this->CI->load->library('test_library', '', 'lolzers');

The test_library extends the base library.

Code:
class Test_library extends Base_library{

    public function __construct(){
    
        parent::__construct();
        
    }
    
    public function lol(){
        echo 'lol';
    }
    
}

But when I try to execute the test controller, it results in what I think is an infinite loop:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in ...etc\Loader.php on line 818

I found out that if I make it that test_library doesn't extend base_library, then it will work.

If I don't assign test_library a different object name, then everything works aswell.

Is there a workaround or is this a bug?
#2

[eluser]InsiteFX[/eluser]
Did you try this?

Code:
class Test_library extends Base_library{

public function __construct(){

parent::Base_library();

}

public function lol(){
echo 'lol';
}

}

InsiteFX
#3

[eluser]CMCDragonkai[/eluser]
That gives me:

Fatal error: Call to undefined method Base_library::Base_library() in C:\wamp\www\stateofwar\application\libraries\Test_library.php on line 7
#4

[eluser]InsiteFX[/eluser]
Did try to load the library befor calling the other library?

InsiteFX
#5

[eluser]CMCDragonkai[/eluser]
Of course, but remember I called the test_library inside the base_library. Base was called in the test controller.




Theme © iAndrew 2016 - Forum software by © MyBB