0
votes

So my Evo site stopped working the other day - just got a 500 error. I got my host to check the logs and found this:

[error] PHP Fatal error:  Cannot redeclare insert_metka() (previously declared in 
/home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code:2) 
in /home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code on line 12

I have tired commenting out the offending line and removing the entire file to no avail. Does anyone know what this means and how to fix it?

EDIT: the code at line 790:

  eval ($pluginCode);
4
Cannot redeclare insert_metka() says that you are declaring a function twice. You should check on your included files. To be sure to not include more than one time, you can use include_once or requiere_once instead of include and requiere - MatRt
Can u give the piece of code at line 790 on the file document.parser.class.inc.php ? - MatRt
@user1073122 added above - MeltingDog
ok, but what containt $pluginCode .? - MatRt
@user1073122 Sorry I have no idea. This is all part of the ModX CMS - I have no idea what it actually does - MeltingDog

4 Answers

1
votes

Looks like a bad plugin has broken your site. Disable all your plugins and reinstate them one at a time until it breaks again, then you know which one is the culprit.

Once you've done that, post the plugin code here and we can help you debug it further. You shouldn't ever need to modify the MODX source code.

The problem is likely to be solved by wrapping the insert_metka() declaration like this:

if(!function_exists('insert_metka')) {
    function insert_metka() {
        // function code
    }
}

http://wiki.modxcms.com/index.php/Creating_Snippets#Wrap_functions_inside_.21function_exists_conditional_if_the_resource_is_needed_to_run_more_than_once_on_a_page

0
votes

That appears like a very simple problem. You are declaring insert_metka() two times. Remove it from one of the mentioned files. Once it is declared in saved file and apparently second time you are trying to declare it with the help of eval()

0
votes

Cannot redeclare insert_metka() says that you are declaring a function twice (may be with your evals).

You should check on your included files.

To be sure to not include more than one time, you can use include_once or requiere_once instead of include and requiere

0
votes

Accoring to document.parser.class.inc.php this line i guess you are using OOP.

So what you can do is create instantiation class for above class and then overwrite it.

There are other things too. you might declaring same function inside of same class.