2013-05-16 32 views
0

我從here下載了一個實時聊天插件。當我嘗試與我的系統集成時,我面臨的問題是「嚴格標準:只有變量應該通過742行的Smarty_Compiler.class.php中的引用傳遞」。任何人可以指導我如何改變742線,以便這個錯誤不會顯示?嚴格標準:只有變量應該通過引用在Smarty_Compiler.class.php上傳遞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; 
} 
?> 
+0

'_compile_arg_list'方法的簽名是什麼? – Barmar

+0

[嚴格標準:只有變量應該通過引用傳遞]的可能重複(http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) –

回答

3

行更改爲:

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

不能使用賦值表達式對於用於按引用傳遞參數,你必須提供一個可以更新的變量。

+0

Thanks @巴爾馬,它的作品。 – n3ISe

相關問題