0

我从这里下载了一个实时聊天插件。当我尝试与我的系统集成时,我遇到的问题是“严格的标准:只有变量应该在 Smarty_Compiler.class.php 的第 742 行通过引用传递”。谁能指导我如何更改第 742 行以使该错误不会显示?

<?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;
}
?>

这是 _compile_arg_list 函数

<?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;
}
?>
4

1 回答 1

3

将行更改为:

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

您不能对通过引用传递的参数使用赋值表达式,您必须提供一个可以更新的变量。

于 2013-05-16T05:45:13.163 回答