0

I downloaded a live chat plugin from here. When I try to integrate with my system I face the problem showing that 'Strict standards: Only variables should be passed by reference in Smarty_Compiler.class.php on line 742'. Can any one guide me how to change on line 742 so that this error wont display?

<?php    
function _compile_custom_tag($tag_command, $tag_args, $tag_modifier)
{
    $this->_add_plugin('function', $tag_command);

    $_cacheable_state = $this->_push_cacheable_state('function', $tag_command);
    $attrs = $this->_parse_attrs($tag_args);
    $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs=''); //line 742

    $_return = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)";
    if($tag_modifier != '') {
        $this->_parse_modifiers($_return, $tag_modifier);
    }

    if($_return != '') {
        $_return =  '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $_return . ';'
            . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline;
    }

    return $_return;
}
?>

Here is the _compile_arg_list function

<?php
function _compile_arg_list($type, $name, $attrs, &$cache_code) {
    $arg_list = array();

    if (isset($type) && isset($name)
        && isset($this->_plugins[$type])
        && isset($this->_plugins[$type][$name])
        && empty($this->_plugins[$type][$name][4])
        && is_array($this->_plugins[$type][$name][5])
        ) {
        /* we have a list of parameters that should be cached */
        $_cache_attrs = $this->_plugins[$type][$name][5];
        $_count = $this->_cache_attrs_count++;
        $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');";

    } else {
        /* no parameters are cached */
        $_cache_attrs = null;
    }

    foreach ($attrs as $arg_name => $arg_value) {
        if (is_bool($arg_value))
            $arg_value = $arg_value ? 'true' : 'false';
        if (is_null($arg_value))
            $arg_value = 'null';
        if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) {
            $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)";
        } else {
            $arg_list[] = "'$arg_name' => $arg_value";
        }
    }
    return $arg_list;
}
?>
n3ISe
  • 159
  • 1
  • 2
  • 16
  • What is the signature of the `_compile_arg_list` method? – Barmar May 16 '13 at 05:42
  • possible duplicate of [Strict Standards: Only variables should be passed by reference](http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) – Lorenz Meyer Jun 21 '14 at 08:29

1 Answers1

3

Change the line to:

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

You can't use an assignment expression for an argument that's passed by reference, you have to provide a variable that can be updated.

Barmar
  • 741,623
  • 53
  • 500
  • 612