简体   繁体   中英

Strict Standards: Only variables should be passed by reference in… on line 777

I get an error on some pages of my website:

Strict Standards: Only variables should be passed by reference in /home/... on line 777

here is this line:

$arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs='');

What should I change? Any help is appreciated.

The problem solved, thanks.

<?php

function foo(&$a){
}

$a = 33;
foo($a); // OK

foo(33); // Fatal error: Only variables can be passed by reference

So fix your code accordingly.

You cannot assign a value in a function call that expects a variable by reference, if you need a default behavior you can set that up in the function itself or before calling it.

$_cache_attrs = '';
$arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs);

maybe 'function' should be callable..

$function = function() { };
$arg_list = $this->_compile_arg_list(
    $function,
    $tag_command,
    $attrs,
    $_cache_attrs=''
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM