问题描述
我在Joomla中遇到此错误:
I am getting this error in Joomla:
Illegal variable `_files` or `_env` or `_get` or `_post` or `_cookie`
or `_server` or `_session` or `globals` passed to script.
我在谷歌搜索方面没有太多帮助.
I didn't get much help googling.
推荐答案
如果您尝试指定名称仅由数字组成的URL参数,则会看到此错误.
You'll see this error if you try to specify a URL parameter whose name consists solely of digits, e.g.
http://www.example.com/?1234567=test
,或者如果您尝试使用保留joomla的变量,例如
or if you try to use a joomla-reserved variable, e.g.
http://www.example.com/?_files=test
这不是一个很好的错误消息.如果您可以访问Unix终端,则可以使用某些命令行工具来调试此类问题,例如
It's not a great error message. If you have access to a unix terminal, you can debug these kind of problems with some command-line tools, e.g.
$ find /var/www/html -exec grep -l 'Illegal variable' {} \;
/var/www/html/libraries/joomla/environment/request.php
这是一个虚构的joomla安装,假设是相当标准的DocumentRoot
.结果立即确认这是一个Joomla错误,并报告导致该错误的文件.从该文件中提取:
This is a fictional joomla installation, assuming a fairly standard DocumentRoot
. The result immediately confirms this is a Joomla error, and reports which file caused it. Extract from that file:
static $banned = array( '_files', '_env', '_get', '_post', '_cookie', '_server', '_session', 'globals' );
foreach ($array as $key => $value)
{
// PHP GLOBALS injection bug
$failed = in_array( strtolower( $key ), $banned );
// PHP Zend_Hash_Del_Key_Or_Index bug
$failed |= is_numeric( $key );
if ($failed) {
jexit( 'Illegal variable <b>' . implode( '</b> or <b>', $banned ) . '</b> passed to script.' );
}
...
}
请注意,错误消息特别容易引起误解,因为不仅是在保留变量名的情况下,而且在参数名是数字的情况下,也会抛出该错误消息.
Note that the error message is particularly misleading because, not only is in thrown in the case of a reserved variable name, but also if the parameter name is numeric.
这篇关于Joomla错误:“非法变量_files或_env或_get或_post或_cookie或_server或_session或全局变量已传递给脚本"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!