PHP Fatal error: Cannot redeclare class
-
Just wanted to give a heads up about some errors that cripple a site immediately upon plugin activation.
I was able to resolve it by wrapping every class in every file with a check wrapper like this:
if (!class_exists('CLASSNAME')) { // original class code for CLASSNAME }
I eventually just put each class in that check wrapper because when I fixed the first redeclare error, another popped up, fixed that one, another popped up, and then I just wrapped them all. Problem solved.
PLUGIN USERS:
You will have to edit the path in rename_me_to_.htaccess file to suit your ABSPATH to the .htpassword_geneated file.@andreacomo (PLUGIN AUTHOR):
I have a modified util.php file that generates the .htacess file with the proper ABSPATH instead of using the seeder file. I can send it your way if you want to release it with a future update.
- The topic ‘PHP Fatal error: Cannot redeclare class’ is closed to new replies.