2012-03-11 2 views
4

경고 : 기준 것으로 예상 showBlogSection(), 라인 /home/smartsta/public_html/includes/Cache/Lite/Function.php 주어진 값 파라미터 3~100줌라 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 - 아파치 - 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"기능을 사용하여 간접적으로 호출되는 것입니다.

해결책은 모든 인수를 참조로 변환하는 것입니다. 제안 :

$id = serialize($arguments); 

이가 시도 보내기

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

에서, call 함수의 시작에서 오른쪽 위 다음 줄을 코드를 넣어!

+0

답변을 주셔서 감사 드리며 이해를 돕습니다. . 솔루션에 대한 조언이 있습니까? –

+0

@ cam77 : 방금 해결책 추가 - 작동한다고 생각합니다 :) 제발, 시험하십시오 –

+0

당신은 선생님이 사람에게 알려진 가장 큰 생명의 은인입니다. 감사!!! –