2014-03-27 47 views
0

嚴格標準:只有變量應通過/home/zumpu/public_html/cats/cats-0.8.0/lib/DataGrid.php上的參考傳遞1519行嚴格標準:只有變量應通過引用傳遞

嚴格的標準:只有變量應當參照在/home/zumpu/public_html/cats/cats-0.8.0/lib/DataGrid.php轉嫁線1535

if ($sizable) 
      { 
       $formatString = '<th align="left" class="resizeableCell" ' 
        . 'style="width:5px; border-collapse: collapse; ' 
        . '-moz-user-select: none; -khtml-user-select: none;'; 

       if (end(array_keys($this->_currentColumns)) != $index) //line 1519 
       { 
        //Uncomment for gray resize bars 
        $formatString .= 'border-right:1px solid gray;'; 
       } 

       $formatString .= 
         'user-select: none;" onmouseover="style.cursor = ' 
        . '\'e-resize\'" onmousedown="startResize(\'cell%s%s\', ' 
        . '\'table%s\', \'cell%s%s\', %s, \'%s\', \'%s\', ' 
        . '\'%s\', \'%s\', this.offsetWidth);">'; 

       echo sprintf(
        $formatString, 
        $md5InstanceName, $index, 
        $md5InstanceName, 
        $md5InstanceName, end(array_keys($this->_currentColumns)),// line 1535 
        $this->_tableWidth, 
        urlencode($this->_instanceName), 
        $_SESSION['CATS']->getCookie(), 
        $data['name'], 
        implode(',', $cellIndexes) 
       ); 

       echo '<div class="dataGridResizeAreaInnerDiv"></div></th>', "\n"; 
      } 
     } 

幫助卡住2我出去IA天

+1

'$ indexes = array_keys($ this - > _ currentColumns); if(end($ indexes)!= $ index)...' –

+0

from docs http://php.net/end --' end(array&$ array)' - >'數組。該數組通過引用傳遞,因爲它由函數修改。這意味着你必須將它傳遞給一個實變量,而不是一個返回數組的函數,因爲只有實際變量可以通過引用傳遞.'必須將變量傳遞給'end()',而不是函數,即。 'array_keys()'。 – Sean

+0

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

回答

0

嚴格地說,你不應該將函數的返回值直接傳遞給anoth這個函數將其參數作爲引用,而不先將其分配給一個命名變量。

通常作品,無論如何,和可能不會打破,[直到PHP版本的變化弄壞]但由於這些原因,產生E_STRICT消息。

這應該刪除消息,但保留目前的功能:

  $keys = array_keys($this->_currentColumns); 

      if (end($keys)) != $index) //line 1519 

      /* ... */ 

      echo sprintf(
       $formatString, 
       $md5InstanceName, $index, 
       $md5InstanceName, 
       $md5InstanceName, end($keys),// line 1535 
       $this->_tableWidth, 
       urlencode($this->_instanceName), 
       $_SESSION['CATS']->getCookie(), 
       $data['name'], 
       implode(',', $cellIndexes) 
      ); 
0

嘗試 -

$keys = array_keys($this->_currentColumns); 
if (end($keys) != $index){ 

$md5InstanceName, end($keys), 

從文檔http://php.net/end -
end (array &$array) - >The array. This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference.必須將一個變量傳遞給end(),而不是函數,即。 array_keys()

相關問題