[wp-hackers] passing references to do_action/apply_filters

Nikolay Bachiyski nbachiyski at developer.bg
Thu Aug 4 12:25:28 GMT 2005

Robert Deaton wrote:
> A quick note, allow_call_time_pass_reference is "1" by default. While
> it doesn't stop the warning, at least we know the code still works on
> default installs for now.

In my case (latest mod_php5 package from ports in FreeBSD) the default 
value is "Off".

I checked the latest php packages and in both php4.4.0 and php5.1.0b3 
the value of "allow_call_time_pass_reference" is "On" in php.ini-dist, 
but is "Off" in php.ini-recommended!

IMHO not just a few administrators prefer to stick to the recommended 
setup, rather to the default one...


> On 8/4/05, Nikolay Bachiyski <nbachiyski at developer.bg> wrote:
>>In newer default php.ini setups the value of
>>allow_call_time_pass_reference (see http://uk2.php.net/ini.core)
>>is Off, which does not allow to pass arguments by reference unless it is
>>explicitly noted in the function's declaration.
>>However, sometimes is is needed a hook to change the values of its
>>arguments. For example see the patch for pre_ping hook
>>(http://trac.wordpress.org/ticket/1489 and
>>http://trac.wordpress.org/changeset/2743 ) and if
>>allow_call_time_pass_reference is Off it causes a Warning: "Warning:
>>Call-time pass-by-reference has been deprecated.." (see
>>Unfortunately there isn't an easy way to control whether
>>do_action/apply_filter arguments are passed by reference of by value.
>>Of course there are some dirty hacks, as for example using an array to
>>pass all the variables:
>>function varargs_by_ref($arg_list = null) {
>>        if (is_array($arg_list)) {
>>                foreach ($arg_list as &$arg) {
>>                        # do whatever you want with $arg...
>>                }
>>        }
>>$by_ref = 'to_be_midified_inside_func';
>>$by_val = 'to_be_passed_by_value';
>>varargs_by_ref(array('baba', &$by_ref, $by_value));
>>Any other suggestions?
>>wp-hackers mailing list
>>wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list