News:

Welcome to the Unofficial Help Forum



Author Topic: Errors in the error log ending with EVAL  (Read 4515 times)

Offline Illori

  • Administrator
  • *
  • Posts: 324
    • View Profile
Errors in the error log ending with EVAL
« on: April 17, 2012, 03:47:43 PM »
For error messages that end in EVAL you need to disable template evaluation. In 2.0 this is a default feature

Admin -> Server Settings -> Disable evaluation of templates
Then post any new error messages without eval in them

In 1.1.1* you need to install a mod first then you can disable the evaluation

You would need this mod installed http://custom.simplemachines.org/mods/index.php?mod=2054 then to disable the template evaluation, admin -> server settings -> feature configuration -> Disable evaluation of templates?

Once you have disabled the template evaluation you will be able to view the exact file and line number that is causing the error the next time you do the action that was causing the issue. Once you get the new error message without eval in it, you can post that and we can try to help you resolve the problem.

If you can not access your forum due to the eval error, you can run this query in phpmyadmin to disable template eval and get the full error message

Code: [Select]
REPLACE INTO smf_settings VALUES ('disableTemplateEval', 1);
Or you can use the following script, or the attachment, to disable template eval, put the script in the same folder as your settings.php file, this script works for both 1.1.1* and 2.0.*

Code: [Select]
<?php
/**
 * Disable Template Evaluation
 *
 * @file ./disable_eval.php
 * @author Matthew Kerle <lab360@simplemachines.org>
 * @copyright Matthew Kerle, 2012
 * @license http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * @version 1.1.0
 */
$disable_eval = new DisableTemplateEval;
class 
DisableTemplateEval
{
protected $db$settings;
public function __construct()
{
$this->smfSettings();
$this->connectDatabase();
$this->setEval();
$this->closeDatabase();
}
protected function smfSettings()
{
global $db_type$db_server$db_user;
global $db_passwd$db_prefix;
if (!file_exists('Settings.php')) {
if (file_exists('../Settings.php'))
$path '../Settings.php';
else
exit('Sorry, you must place this file in the same directory as SMF\'s Setting.php file.');
}
else
$path 'Settings.php';
require($path);
if (isset($db_type) && $db_type != 'mysql')
exit('Sorry, this script currently only supports MySQL.');
$this->settings = array(
'db_server' => $db_server,
'db_name' => $db_name,
'db_user' => $db_user,
'db_pass' => $db_passwd,
'db_prefix' => $db_prefix
);
return true;
}
protected function connectDatabase()
{
$this->db mysql_connect($this->settings['db_server'], $this->settings['db_user'], $this->settings['db_pass']);
if (!$this->db)
exit('Sorry, we were unable to connect to your database via the SMF Configuration Settings.');
mysql_select_db($this->settings['db_name'], $this->db);
}
protected function setEval()
{
mysql_query('REPLACE INTO ' $this->settings['db_prefix'] . 'settings (variable, value) VALUES("disableTemplateEval", 1)'$this->db);
exit ('Template Eval Successfully Disabled!');
}
protected function closeDatabase()
{
mysql_close($this->db);
}
}
« Last Edit: April 18, 2012, 11:53:31 AM by Illori »

 

anything