Jump to content

Cannot redeclare....


helmut2509
 Share

Recommended Posts

 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?

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

Tjxyf3s.png

  • Like 4
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...