警告:参数3 to showBlogSection()应该是一个引用,值在第100行的/home/smartsta/public_html/includes/Cache/Lite/Function.php中给出
我突然在我的Joomla网站上的内容区域显示上述错误,有什么建议吗?
更新: 没有这样的运气找到访问godaddy ftp文件目录,ftp或Joomal C面板中定义的文件和目录。 在FTP中,我无法找到对此特定文件的访问权以调查第100行的内容。在Joomla面板中,在全局配置中,我能够将“错误消息”切换为无,因为至少要隐藏此错误。 在缓存目录中,虽然显示,但我没有看到进入该文件夹的任何选项。 我也在c-panel屏幕的底部看到这个,但只是链接到一个joomla帮助站点,并且在字段内我没有看到描述区域切换'ON或OFF'“以下PHP服务器设置不是最佳的安全性并建议更改它们:PHP register_globals设置为ON而不是OFF “
UPDATE2 !:
我发现有问题的文件,下面是代码。 第100行仅说明:
global $$ object_123456789;
application / 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 <sb@sebastian-bergmann.de> * @author Fabien MARTY <fab@php.net> */ // 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; } } ?>Warning: Parameter 3 to showBlogSection() expected to be a reference, value given in /home/smartsta/public_html/includes/Cache/Lite/Function.php on line 100
I'm getting the above error displaying within my content areas on my Joomla site all a sudden, any suggestions?
Update: No such luck finding access to defined file and directory within godaddy ftp file directory, ftp, or Joomal C-panel. Within FTP, I cannot find access to this particular file to investigate what is on line 100. Within the Joomla panel, in Global Configurations, I was able to toggle 'error message' to none for atleast this error to be hidden. Within the cache directory I do not see any options to get into the folder, though it displays. I also see this at the bottom of that c-panel screen, but just links to a joomla help site, and within the fields I do not see described area to toggle 'ON or OFF' "Following PHP Server Settings are not optimal for Security and it is recommended to change them: PHP register_globals setting is ON instead of OFF "
Update2!:
I've found the file in question, below is the code. Line 100 only states:
global $$object_123456789;
application/x-httpd-php Function.php PHP script text
<?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 <sb@sebastian-bergmann.de> * @author Fabien MARTY <fab@php.net> */ // 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; } } ?>最满意答案
这不完全是一个错误。 这是一个警告 。
突然? 也许你已经升级/更新了你的PHP版本。 或者将PHP配置更改为“严格模式”。
消息“ 预期为参考,给定值 ”表示预期接收引用而不是值的被调用函数。 看:
$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当您通过“按引用”传递时,该函数可以更改上面示例中的变量值...:
function show_section(&$parameter) { $parameter = 'changed!'; }注意&符号&在$parameter之前 - 这是我们指定函数需要REFERENCE的方式。
在函数调用之后,在上面的例子中,变量$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);试一试!
It is not exactly an error. It is a warning.
Suddenly? Perhaps you have upgraded/updated your PHP version. Or changed PHP configuration to "strict mode".
The message "expected to be a reference, value given" means the called function expected to receive a reference, not a value. Look:
$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 VALUEWhen you pass "by reference", the function can change the variable value... in the example above:
function show_section(&$parameter) { $parameter = 'changed!'; }Note the ampersand symbol & before the $parameter - this is how we specify a function requires a REFERENCE.
AFTER the function call, in the example above, the variable $something value will be the changed! string.
The line throwing the error is NOT the "global" one. It is the next:
$result = call_user_func_array(array($$object_123456789, $method), $arguments);The problem here is that the function is being called indirectly by using the "call_user_func_array" function.
A solution would be transforming all arguments into references. Suggestion:
foreach ($arguments as $count => $value) { $param = 'param' . $count; $$param = $value; $arguments[$count] = &$$param; }Put the code above in the beginning of the call function, right after the following line:
$id = serialize($arguments);Give this a try!
更多推荐
file,function,cache,Cache_Lite,电脑培训,计算机培训,IT培训"/> <meta name=&quo
发布评论