[development] namespaced global variables [WAS: Drupal 6.2 theme system standalone]

Bob Pepin bob.pepin at gmail.com
Sat Jun 14 15:27:28 UTC 2008

the same array($classname, $methodname) format is supported by
call_user_func_array, and according to the doc at php.net

Note: Referenced variables in param_arr  are passed to the function by
a reference, others are passed by a value. In other words, it does not
depend on the function signature whether the parameter is passed by a
value or by a reference.

No idea though if it's always been that way or if it's changed
recently or if maybe it goes back to passing by value if we're calling
an object method.

On Sat, Jun 14, 2008 at 17:12, Adrian Rossouw <adrian at bryght.com> wrote:
> On 14 Jun 2008, at 5:03 PM, Bob Pepin wrote:
>> On a side note, the next person designing a callback interface should
>> also keep in mind that call_user_func can take array($classname,
>> $methodname) as first argument. Would have avoided all the name
>> clashes with callbacks in themes right now.
> except when you use that format you can't pass references to functions, as
> it makes copies of everything
> chx wrote a simple call_user_func array replacement that passes references a
> few years ago.
> basically :
> function call($func, &$var1, &$var2, &$var3, &$var4, &$var5, &$var6 ... etc)
> {
>        if (function_exists($func) {
>                return $func($func, &$var1, &$var2, &$var3, &$var4, &$var5,
> &$var6 ... etc);
>        }
> }

More information about the development mailing list