Welcome Guest, Not a member yet? Register   Sign In
Strange things when debugging Common.php->load_class
#1

[eluser]Unknown[/eluser]
Ok, this is driving me nuts (and it's a short drive to boot) ..

In the core/Common.php file there is the following function and first line of its code:

function &load;_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();

I set a breakpoint at both the function and the static $_classes line. I then use xdebug in both Netbeans and Eclipse to debug the code. I tried both "step into" until I hit the static line and run to breakpoint. Either way, as soon as I execute the "static $_classes = array();" line, the array has the Exceptions/CI_Exception object in it. The first time it is called, it is to load the Benchmark class, but in any event the array should be empty the first time the static line is called and instead it is already populated with the Exceptions class. I search the whole project including the app and sys folders, and the only place the $_classes is declared is in this one spot.

So the question is, how is the array already populated with the Exceptions class the first time it is defined if I never see any code execute that does this?

I have tried this in both Netbeans and Eclipse so I know it's not a bug in the IDE, although it could be something with xdebug. There also doesn't seem to be any Ajax so I don't think the load_class function is being called asynch which would bypass the debugger.

Any thoughts would be appreciated.
Thanks in advance

Matt
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

From what I can see, the $_classes array is empty at the beginning, and the first class to be loaded is the Benchmark class.

Possible causes:
1) You have a Gremlin in your system.
2) You're going mad.
3) I'm going mad.
4) Any combination of the above.

The exceptions class is loaded on demand when "show_error()" is called. If you examine your call stack, I'm sure you'll find that something is throwing an error using show_error() which is why it's the first class to be loaded. However, $_classes can not possibly be populated until at least one call has been made to load_class(). I can only assume you've found an XDebug bug, or that something is not configured correctly on your server.




Theme © iAndrew 2016 - Forum software by © MyBB