Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong entry in the must_have_modules_list.xml file => error updating modules #22267

Closed
IJVo opened this issue Dec 6, 2020 · 6 comments
Closed
Labels
1.7.7.0 Affects versions BO Category: Back Office Bug Type: Bug Fixed Resolution: issue closed because fixed Module manager Label: Which BO under menu is concerned

Comments

@IJVo
Copy link

IJVo commented Dec 6, 2020

The file must_have_modules_list.xml contains the entry of the module 'id' = 29992, which does not have the field 'name' filled in. Because of this, any module update crashes. Please fix it.

The error is reflected in the class ModuleCore function getModulesOnDisk() where $modaddons->name from the $xml file is not checked.
This calls with an error when calling Module::isModuleTrusted(), which calls Module::checkModuleFromAddonsApi(), which calls Module::getInstanceByName ($ module_name).
There it will be a error.
Please fix it. Thank you.

@IJVo
Copy link
Author

IJVo commented Dec 6, 2020

In the class ModuleCore, add after

if ($xml && isset($xml->module)) {
    foreach ($xml->module as $modaddons) {

this code
        if (($modaddons->name == '') || (!Validate::isModuleName($modaddons->name))) {
            continue;
        }

@matks
Copy link
Contributor

matks commented Dec 6, 2020

Hi @IJVo thank you for the bug report! We are going to fix this misconfiguration.

However I dont understand

Because of this, any module update crashes. Please fix it.

I just upgraded 2 modules in my PS 1.7.7.0 shop without issues. Maybe only some modules do crash, if they meet some requirements?

@IJVo
Copy link
Author

IJVo commented Dec 6, 2020

This will only take effect if the PrestaShop administrator is logged in to Addons and the updated file containing the error is downloaded.

@leekung
Copy link

leekung commented Dec 7, 2020

When in dev mode, the ModuleCore throw error and die, this error prevent any module to upgrade. even if the upgrading module doesn't have any error.

    public static function getInstanceByName($module_name)
    {
        if (!Validate::isModuleName($module_name)) {
            if (_PS_MODE_DEV_) {
                die(Tools::displayError(Context::getContext()->getTranslator()->trans('%1$s is not a valid module name.', array(Tools::safeOutput($module_name)), 'Admin.Modules.Notification')));
            }
            return false;
        }

@matks
Copy link
Contributor

matks commented Dec 7, 2020

Hi everybody, the issue in must_have_modules_list.xml has been fixed. Be aware that this file is stored in cache by your shop so you need to clear it, and PrestaShop will download the new (fixed) version 😉

@hibatallahAouadni hibatallahAouadni added 1.7.7.0 Affects versions Addons module available BO Category: Back Office Bug Type: Bug Module manager Label: Which BO under menu is concerned Fixed Resolution: issue closed because fixed labels Dec 7, 2020
@hibatallahAouadni
Copy link
Contributor

Hello @leekung

Thanks @matks for your quick replies and fix 😉

@leekung it seems your issue is fixed.
So I close this issue, feel free to open a new one if you encounter another problem.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.7.0 Affects versions BO Category: Back Office Bug Type: Bug Fixed Resolution: issue closed because fixed Module manager Label: Which BO under menu is concerned
Projects
None yet
Development

No branches or pull requests

4 participants