Hello All,

I am new to the list so please be gentle :)

I am working on a PHP framework and have run up against a functionality
hurdle which I keep falling at. Basically, I have three mechanisms which all
function in a similar way and require this functionality: templating, event
handling and "action handling". Within the core code of the application, as
is common with many applications with plugin architecture, I pass a number
of parameters to functions which have hooked into a particular "event". Part
of the mechanism is that parameters can be passed by reference to allow for
the listeners to make modifications.


register_action_listener('process_user', function($username, $account_type,
$password){$username.="." . $account_type;} // Or whatever

call_action('process_user', &$username, &$account_type, &$password);
//Result: $username == "bob.ISV"

Now, what I am trying to do is establish a method to prevent the "hook"
functions from making changes by reference without reference explicitly
being passed to them by the calling code.

I have thought of a method which simply makes a copy of all the parameters
for each listener within call_action(), however what I would really love is
a function which returns whether or not the supplied variable is available
in multiple scopes or is in the original scope which it was initialized in.
Does anyone know of a way to achieve this?


Reply via email to