2012-03-11 47 views
4

警告:参照であることが期待showBlogSection()、ライン上/home/smartsta/public_html/includes/Cache/Lite/Function.phpで与えられた値にパラメータ3 100JoomlaのPHPエラー

私のJoomlaサイトのコンテンツエリアに上記のエラーが突然表示されています。

更新:GoDaddyはFTPファイルのディレクトリ、FTP、またはJoomal C-パネル内の定義されたファイルやディレクトリへのアクセスを見つけることはありません、このような幸運。 FTP内で、この特定のファイルにアクセスして、100行目のファイルを調べることができません。 Joomlaのパネル内で、グローバル構成では、このエラーを少なくとも非表示にするために「エラーメッセージ」をnoneに切り替えることができました。キャッシュディレクトリ内には、フォルダに入るためのオプションは表示されませんが、表示されます。 これはCパネル画面の下部にも表示されていますが、joomlaのヘルプサイトにリンクしているだけで、「ONまたはOFF」を切り替えるための領域が表示されません 「PHPサーバーの設定が最適ではありませんセキュリティのために、それはそれらを変更することをお勧めします。 PHPはregister_globalsの設定があるON代わりに私は、問題のファイルを見つけた

OFF

アップデート2 !:で、以下のコードは、 。ライン100のみの状態:

グローバル$$ object_123456789;

アプリケーション/ X-のhttpd-phpのFunction.php PHPスクリプトテキスト

<?php 

/** 
* This class extends Cache_Lite and can be used to cache the result and output of functions/methods 
* 
* This class is completly inspired from Sebastian Bergmann's 
* PEAR/Cache_Function class. This is only an adaptation to 
* Cache_Lite 
* 
* There are some examples in the 'docs/examples' file 
* Technical choices are described in the 'docs/technical' file 
* 
* @package Cache_Lite 
* @version $Id: Function.php 47 2005-09-15 02:55:27Z rhuk $ 
* @author Sebastian BERGMANN <[email protected]> 
* @author Fabien MARTY <[email protected]> 
*/ 

// no direct access 
defined('_VALID_MOS') or die('Restricted access'); 

require_once($mosConfig_absolute_path . '/includes/Cache/Lite.php'); 

class Cache_Lite_Function extends Cache_Lite 
{ 

    // --- Private properties --- 

    /** 
    * Default cache group for function caching 
    * 
    * @var string $_defaultGroup 
    */ 
    var $_defaultGroup = 'Cache_Lite_Function'; 

    // --- Public methods ---- 

    /** 
    * Constructor 
    * 
    * $options is an assoc. To have a look at availables options, 
    * see the constructor of the Cache_Lite class in 'Cache_Lite.php' 
    * 
    * Comparing to Cache_Lite constructor, there is another option : 
    * $options = array(
    * (...) see Cache_Lite constructor 
    * 'defaultGroup' => default cache group for function caching (string) 
    *); 
    * 
    * @param array $options options 
    * @access public 
    */ 
    function Cache_Lite_Function($options = array(NULL)) 
    { 
     if (isset($options['defaultGroup'])) { 
      $this->_defaultGroup = $options['defaultGroup']; 
     } 
     $this->Cache_Lite($options); 
    } 

    /** 
    * Calls a cacheable function or method (or not if there is already a cache for it) 
    * 
    * Arguments of this method are read with func_get_args. So it doesn't appear 
    * in the function definition. Synopsis : 
    * call('functionName', $arg1, $arg2, ...) 
    * (arg1, arg2... are arguments of 'functionName') 
    * 
    * @return mixed result of the function/method 
    * @access public 
    */ 
    function call() 
    { 
     $arguments = func_get_args(); 
     $id = serialize($arguments); // Generate a cache id 
     if (!$this->_fileNameProtection) { 
      $id = md5($id); 
      // if fileNameProtection is set to false, then the id has to be hashed 
      // because it's a very bad file name in most cases 
     } 
     $data = $this->get($id, $this->_defaultGroup); 
     if ($data !== false) { 
      $array = unserialize($data); 
      $output = $array['output']; 
      $result = $array['result']; 
     } else { 
      ob_start(); 
      ob_implicit_flush(false); 
      $target = array_shift($arguments); 
      if (strstr($target, '::')) { // classname::staticMethod 
       list($class, $method) = explode('::', $target); 
       $result = call_user_func_array(array($class, $method), $arguments); 
      } else if (strstr($target, '->')) { // object->method 
       // use a stupid name ($objet_123456789 because) of problems when the object 
       // name is the same as this var name 
       list($object_123456789, $method) = explode('->', $target); 
       global $$object_123456789; 
       $result = call_user_func_array(array($$object_123456789, $method), $arguments); 
      } else { // function 
       $result = call_user_func_array($target, $arguments); 
      } 
      $output = ob_get_contents(); 
      ob_end_clean(); 
      $array['output'] = $output; 
      $array['result'] = $result; 
      $this->save(serialize($array), $id, $this->_defaultGroup); 
     } 
     echo($output); 
     return $result; 
    } 

} 

?> 
+1

100番の/home/smartsta/public_html/includes/Cache/Lite/Function.phpを調べると、そこには何が表示されますか?エラーを表示する代わりにエラーを記録するだけで、ページに*表示されないようにする必要があります。 – hakre

+0

私はまだファイルをチェックアウトしていませんが、この 'all-a-sudden-error'の前にコード内に何も間違っていませんでした。それは何かがちょうど100行目に現れる可能性もありますか?ページに表示されないようにエラーを記録するにはどうすればよいですか? –

+0

この返答いただきありがとうございます! –

答えて

7

まさにエラーではありません。 警告です。

突然ですか? PHPのバージョンをアップグレード/更新した可能性があります。または、PHPの設定を "strict mode"に変更しました。

メッセージ「参照であることが期待所定の値は」参照、ないを受信するように期待という関数を意味します。見て:$parameter

function show_section(&$parameter) { 
    $parameter = 'changed!'; 
} 
  1. 注アンパサンド記号&

    あなたは「参照によって」合格
    $something = 9; 
    show_section($something); 
    // here you are passing a variable 
    // this will be accepted as a reference 
    
    show_section(9); 
    // here you are NOT passing a reference 
    // here you are passing a VALUE 
    

    が、機能は上記の例で...変数の値を変更することができます - これは、関数がREFERENCEを必要とすることを指定する方法です。

  2. 上記の例では、変数$somethingの値はchanged!文字列になります。


エラーをスローラインは、 "グローバルな" ものではありません。それは次です:

$result = call_user_func_array(array($$object_123456789, $method), $arguments); 

ここでの問題は、機能が「call_user_func_array」機能を使用することによって間接的に呼び出されていることです。

解決策は、すべての引数を参照に変換することです。提案:

foreach ($arguments as $count => $value) 
{ 
    $param = 'param' . $count; 
    $$param = $value; 
    $arguments[$count] = &$$param; 
} 

call関数の先頭で上記のコードを入れて、右後に次の行:

$id = serialize($arguments); 

はこの試してみて!

+0

お返事をいただきありがとうございます。ソリューションに関するアドバイスはありますか? –

+0

@ cam77:ちょうど解決策が追加されました - 私はそれがうまくいくと思います:) :) please、test –

+0

あなたは人に知られている最大の人生保護者です。ありがとう!!! –