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.
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
or if you try to use a joomla-reserved variable, e.g.
http://www.example.com/?_files=test
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
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.
It's not an error PHP generates, it's an error that seems to belong to Joomla!. I found this page after 20 seconds of Googling for "Illegal variable".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With