> $hello = $clsHello;

If that conceptual statement (or any occurance of the conceptual $hello) were 
in the code, then my (really good) Find feature of my code editor would have 
found it.


> There are only a few variables that get assigned as side effects of
>  functions, but they have very specific names, and none of them are
> $hello (but I'm guessing that's not the actual variable name)

I have two dozen classes in this application. In every case, there will be a 
variable, the name of which is a lowercase variant of the class name, to which 
is assigned an instance of the class, when the class's construct() function 
completes. The example informs you of this.


> Somewhere in your code there is something that is assigning to $hello.
> Find everything that's doing that and look at each instance in detail.

I have. Many times. What I am looking for is a side-effect -- something not 
obvious. (This application does not use an eval() function where some 
obfuscated string manipulation would play this out.)


> I would say for definite that it's some of the surrounding code,

Exactly. No sooner and no later than precisely when the class's construct() 
function ends, and control is given to the next statement after the one that 
instantiated that class.


> probably something similar to this:

Let's explore this statement:

> $GLOBALS[strtolower(get_class($this))] = $this;

May I infer that the declaration of $GLOBALS['hello'] will, at the same time, 
also create $hello (without a statement declaring such)?

This:
http://php.net/manual/en/reserved.variables.globals.php
implies the opposite direction.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to