Page 1 of 1

Issue upgrading with admin/cfg_modules

Posted: Thu Jul 22, 2021 4:55 pm
by Greasemonkey
Hey all, I'm working on upgrading an installation I've been testing using @zipurman fantastic upgrading tool.

Everything has been going smoothly - however have run into an issue with admin/cfg_modules at v 1.0.7.7 with

Code: Select all

            $this->_modules[] = [
              'code' => $class::CODE,
              'directory' => $class::DIRECTORY,
              'language_directory' => $class::LANGUAGE_DIRECTORY,
              'key' => $class::KEY,
              'title' => $class::TITLE,
              'template_integration' => $class::TEMPLATE_INTEGRATION,
Complaining like this
[22-Jul-2021 12:32:16 America/Toronto] PHP Fatal error: Uncaught Error: Undefined class constant 'CODE' in /home/xxxxx/public_html/*****/admin/includes/classes/cfg_modules.php:26
Stack trace:
#0 /home/xxxxx/public_html/*****/admin/includes/application_top.php(150): cfg_modules->__construct()
#1 /home/xxxxx/public_html/*****/admin/index.php(13): require('/home/flournet/...')
#2 {main}
thrown in /home/xxxxx/public_html/*****/admin/includes/classes/cfg_modules.php on line 26
The old code works perfect.... I see no reason, other than some sort of php configuration why the new code won't work - ideas?

Re: Issue upgrading with admin/cfg_modules

Posted: Thu Jul 22, 2021 5:49 pm
by ecartz
Have you updated any cfg_modules provided by add-ons as posted at https://github.com/CE-PhoenixCart/Phoen ... 5615b8d352

Re: Issue upgrading with admin/cfg_modules

Posted: Thu Jul 22, 2021 5:55 pm
by Greasemonkey
@ecartz ahhhh.... perfect yes. Working on this now.

Re: Issue upgrading with admin/cfg_modules

Posted: Fri Jul 23, 2021 2:55 pm
by Greasemonkey
@ecartz maybe you can help track down another one - now with a content module?

I have
[23-Jul-2021 10:09:33 America/Toronto] PHP Fatal error: Uncaught Error: Cannot declare self-referencing constant 'self::CONFIG_KEY_BASE' in /home/xxxx/public_html/*****/admin/modules_content.php:38
Stack trace:
#0 {main}
thrown in /home/xxxx/public_html/*****/admin/modules_content.php on line 38
However can't find any content module using: self::CONFIG_KEY_BASE.

I was going to just shut off each module one by one till I found it.... but the content module admin page is what get the fatal error.

Maybe just renaming them to .old one by one?

Re: Issue upgrading with admin/cfg_modules

Posted: Fri Jul 23, 2021 4:43 pm
by ecartz
Greasemonkey wrote: Fri Jul 23, 2021 2:55 pm Maybe just renaming them to .old one by one?
Or just move them into a temporary directory (e.g. contents_temp) and move them back until you find the one that's not working. That might be easier than renaming, which would also work. Just rename the directory, create a new contents directory and copy the folders back in one-by-one.

In 1.0.8.4, you would still have https://github.com/CE-PhoenixCart/Phoen ... 488f9dac4f unless you fixed it manually.

Re: Issue upgrading with admin/cfg_modules

Posted: Sat Jul 24, 2021 5:37 pm
by zipurman
Greasemonkey wrote: Fri Jul 23, 2021 2:55 pm Maybe just renaming them to .old one by one?
Another debug option is to edit admin/modules_content.php and add:

echo $class;

Above the "if (class_exists($class)) {"

which will show you the classes being loaded. If the error is visible on the screen, this should help. If it's in the logs only, you could:

error_log('my debug: ' . $class);

This method also helps you get a better understanding of how Phoenix loads modules.

Obviously, after you fix the issue, remove any changes you made to modules_content.php