Part of the EllisLab Network
   
2 of 2
2
new v1.5 Loader bug? - Loader attempts to include() class file multiple times
Posted: 01 November 2006 10:36 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Rank
Total Posts:  72
Joined  04-26-2006
coolfactor - 01 November 2006 10:24 AM
hlz - 01 November 2006 05:15 AM

Maybe CI’s way of loading libraries is not the best way in this case as i need multiple instances of the same library/class. Therefor a $ci->load->class(‘myclass’) method could be handy. It should only load the library-class and leave the rest to the developer.

So, any thoughts? Or, perhaps an alternate solution?

Now that the core libraries are extendable, you could add your class() method to the Loader, at least under PHP 5. Rick fixed Loader extendibility at the last minute for v1.5.0, but I’m not sure about support in PHP 4 yet. I’m sure he addressed that, but you’ll need try it.

Ah, no, the loader cannot be extended in PHP4. Already tried. Edit: you are right, it does in PHP5.

Profile
 
 
Posted: 01 November 2006 12:02 PM   [ Ignore ]   [ # 17 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  2541
Joined  12-21-2001

As I indicated earlier in this thread, the new build I uploaded yesterday fixes the multiple loading issue, so you can include things as many times as you want, including libraries.

 Signature 
Profile
MSG
 
 
Posted: 01 November 2006 07:08 PM   [ Ignore ]   [ # 18 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

There are still some errors in the loader. When i load a custom made library some things go wrong. even if this class has only an empty constructor.
for an example:
Error demo

using CI 1.5.0.1, with the following auto-libs:

$autoload['libraries'] = array('database', 'pagination','publisherlib');

publisherlib:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class
Publisherlib{
    
var $obj;

    function
Publisherlib()
    
{
        $this
->obj =& get_instance();
        
    
}
   
   
function getheadlines($site_id)
   
{
      $this
->obj =& get_instance();
      
$this->obj->load->model('Articlesmodel');
      return
$this->obj->Articlesmodel->get_last_ten_headlines($site_id);   
   
}
   
   
function gettopics($site_id)
   
{
      $this
->obj =& get_instance();
      
$this->obj->load->model('Topicmodel');
      return
$this->obj->Topicmodel->get_last_ten_topics($site_id);   
   
}  
}
?>


even when i comment all functions, I get this error. but when I remove publisherlib from the auto load. the page works perfect. except the fuctions using publisherlib.

I hope there will be a solution. other wise I have to downgade to 1.4.1

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 01 November 2006 07:37 PM   [ Ignore ]   [ # 19 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1737
Joined  06-23-2006

jappio,

I get a blank page for your Demo link, but when I view the source, I get this:

<HTML>
<
HEAD>
</
HEAD>
<
FRAMESET FRAMEBORDER="NO">

   <
FRAME SRC="http://fphpcode.nl/index2.php">


</
FRAMESET>
<
NOFRAMES>
There is no frame support on your browser.
</
NOFRAMES>
</
HTML>

Is your site supposed to be frame-based?
Is index2.php a Code Igniter front-controller?

 Signature 

Mac OS X 10.4.10, Apache 1.3.3, PHP 5.2.3, CodeIgniter 1.5.x., baby!

Profile
 
 
Posted: 02 November 2006 05:50 AM   [ Ignore ]   [ # 20 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

yes it is. But this will not make any difrence. When you address http://fphpcode.nl/index2.php you will see the same message.
But if i remove the Lib which i posted. I don’t get this message.

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 02 November 2006 06:44 AM   [ Ignore ]   [ # 21 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  481
Joined  03-08-2006

You don’t need $this->obj =& get_instance(); in every function, just in the constructor like you already have.

 Signature 

Flickr | Last.fm | Del.icio.us

Profile
 
 
Posted: 02 November 2006 06:49 AM   [ Ignore ]   [ # 22 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

removed it. but no change:(

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 02 November 2006 06:59 AM   [ Ignore ]   [ # 23 ]  
Grad Student
Rank
Total Posts:  72
Joined  04-26-2006

First, there is an error in http://demo.fphpcode.nl/. There are too many redirects being generated. As a result I think I can’t see the same message you are seeing.

Second, are you sure you have CI 1.5.0.1 (the new Loader.php) and not a cached version of the download?

Profile
 
 
Posted: 02 November 2006 07:08 AM   [ Ignore ]   [ # 24 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

Gonna try to download it again. But I don’t think this will help

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 02 November 2006 07:10 AM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

it didn’t work. I think I go back to the point where everything worked. And try an update again.

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 02 November 2006 07:14 AM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  72
Joined  04-26-2006

What PHP Error do you get? (as i can’t see it)

Profile
 
 
Posted: 02 November 2006 07:18 AM   [ Ignore ]   [ # 27 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

I didn’t get an error. You have seen the page. It looks like an over load.
I will remove everything and start with a clean CI install. I hope that will solve the problem

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 02 November 2006 07:23 AM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  72
Joined  04-26-2006
jaapio - 02 November 2006 07:18 AM

I didn’t get an error. You have seen the page. It looks like an over load.
I will remove everything and start with a clean CI install. I hope that will solve the problem

Did you use the redirect() function? Because that is what your link does: infinite redirects.

Profile
 
 
Posted: 02 November 2006 08:01 AM   [ Ignore ]   [ # 29 ]  
Summer Student
Avatar
Total Posts:  23
Joined  10-09-2006

It is working again. There was an error in a model. When I uploaded the backup of my application everything worked. I didn’t search for an error in a model for this.

 Signature 

<? echo $_GET[‘a_life’]; ?>

Profile
 
 
Posted: 08 November 2006 02:40 PM   [ Ignore ]   [ # 30 ]  
Research Assistant
RankRankRank
Total Posts:  551
Joined  06-17-2006

I’ve experienced this when I tried repalcing native (session) classes.

Refer to this post: http://codeigniter.com/forums/viewthread/46640/. I’ve updated that pos with info related to the native session but I feel that the problem described in both posts could be a a result of the same problem.

 Signature 

CodeCrafter - Open Source Code Generation for CI

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64457 Total Logged-in Users: 13
Total Topics: 80969 Total Anonymous Users: 0
Total Replies: 435701 Total Guests: 184
Total Posts: 516670    
Members ( View Memberlist )
Active Members:    awptiCrucialDark PreacherFrank Bergerhjuehuglejulguslittle brittlemahutiorotonepsiborgsajmunsharpe