helmut2509 Posted August 20, 2018 Posted August 20, 2018 When calling a page, I get the error (logged in /logs/errors.txt):"Cannot redeclare myfunction..(previously declared in...)" It seems there is a second declaration of this function, but where? I already added the namespace Processwire and switched off template compiling, but to no avail. (PW version 3.0.42) any ideas?
dragan Posted August 20, 2018 Posted August 20, 2018 You should check your template file and all include-files (_init.php, _func.php or whatever you use). As the error msg says: you are re-declaring a function somewhere. With a good IDE you should be able to search across all files and spot it easily. 1
helmut2509 Posted August 20, 2018 Author Posted August 20, 2018 I checked the entire project folder: there is only ONE declaration of this function!
bernhard Posted August 20, 2018 Posted August 20, 2018 you can get this error if you have only one declaration but you call it multiple times (eg by including it multiple times). maybe you have markup regions turned on? you could use tracy and a simple bd('test'); to see how often it is called. then you can inspect the backtrace: bd(debug_backtrace()); 4
Gideon So Posted August 20, 2018 Posted August 20, 2018 What is the function name. Is there any chance your function name conflicts with one of the Processwire function or one of the module's function? Gideon 1
Zeka Posted August 20, 2018 Posted August 20, 2018 @helmut2509 Also, do you use URL segments or call $page->render() somewhere?
helmut2509 Posted August 20, 2018 Author Posted August 20, 2018 thanks. I guess the bug is most probably related to a multiple including of a script.
adrian Posted August 20, 2018 Posted August 20, 2018 1 hour ago, helmut2509 said: I checked the entire project folder: there is only ONE declaration of this function! No use now that you have checked this, but an FYI for the future, the Tracy Template Resources panel shows you all functions and where they were defined. 1
helmut2509 Posted August 20, 2018 Author Posted August 20, 2018 I use $view->render , where $view is the instance of a template.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now