Welcome Guest, Not a member yet? Register   Sign In
*RECURSION* on CI_Loader object
#1

[eluser]daveWid[/eluser]
I have been trying to get under the hood of CI to get a better of understanding of how it all works and what all is loaded in.

To see what is loaded by default I put the following code on the welcome view that comes stock with CI. (I didn't change any settings after I downloaded)

Code:
<pre>
  &lt;?php print_r($this); ?&gt;
</pre>

and found that the load property is outputted as

Code:
[load] => CI_Loader Object
*RECURSION*

Just to see how deep the recursion was I changed to the code below and reloaded the page.

Code:
<pre>
  &lt;?php print_r($this->load->load->load->load); ?&gt;
</pre>

The load property is output the same.

It looks like the Loader class in continually loading itself into a load property. Maybe I am doing something wrong or don't understand the Loader class fully, but this doesn't seem like it should be happening.

I'm testing on Leopard's default Apache/PHP5 install if that helps any.
#2

[eluser]daveWid[/eluser]
The more I think about it, this just maybe the Loader class holding a reference to itself, like in a Singleton pattern, and the print_r function just keeps looping through it. I couldn't find the reference in the class, but it could be loaded in dynamically or I just missed it.

If that is the case then nothing to worry about.
#3

[eluser]Multisnet[/eluser]
I'm trying to serialize an object but I faced with the recursion problem, because instead of serialize the object I wanted, all CI Loader Object is serialized. Any idea how to solve this?

Cheers




Theme © iAndrew 2016 - Forum software by © MyBB