ModX Evo: PHP error in document.parser.class.inc.php

ε祈祈猫儿з 提交于 2020-01-16 12:36:08

问题


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);

回答1:


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




回答2:


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()




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/15470293/modx-evo-php-error-in-document-parser-class-inc-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!