Jump to content

Edit History

DeParagon

DeParagon

You need to check the error log, the error file may be within the PrestaShop root directory or the directory below it.

In one of the cases i have witnessed, this error was caused by "require_once" -- requiring a  missing module file

e.g

require_once(/......./...../public_html/shop/modules/contactform/recaptcha.php): failed to open stream: No such file or directory in /....../......./public_html/shop/src/Adapter/Module/Module.php on line 354

 

I updated the method instanciateLegacyModule to the one below.

I used php file_exists function to check if the file exists before requiring the file   

 protected function instanciateLegacyModule()
    {
        /*
         * @TODO Temporary: This test prevents an error when switching branches with the cache.
         * Can be removed at the next release (when we will be sure that it is defined)
         */
        $path = $this->disk->get('path', ''); // Variable needed for empty() test
        if (empty($path)) {
            $this->disk->set('path', _PS_MODULE_DIR_ . DIRECTORY_SEPARATOR . $this->attributes->get('name'));
        }
        // End of temporary content
        
        if(file_exists($this->disk->get('path') . DIRECTORY_SEPARATOR . $this->attributes->get('name') . '.php')) {
            require_once $this->disk->get('path') . DIRECTORY_SEPARATOR . $this->attributes->get('name') . '.php';
             $this->instance = LegacyModule::getInstanceByName($this->attributes->get('name'));
        }
        
       
    }

Hope this helps

DeParagon

DeParagon

You need to check the error log, the error file may be within the PrestaShop root directory or the directory below it.

In one of the cases i have witnessed, this error was caused by "require_once" -- requiring a  missing module file

e.g

require_once(/......./...../public_html/shop/modules/contactform/recaptcha.php): failed to open stream: No such file or directory in /....../......./public_html/shop/src/Adapter/Module/Module.php on line 354

 

I updated the method instanciateLegacyModule to the one below.

I used php file_exists function to check if the file exists before requiring the file   

 protected function instanciateLegacyModule()
    {
        /*
         * @TODO Temporary: This test prevents an error when switching branches with the cache.
         * Can be removed at the next release (when we will be sure that it is defined)
         */
        $path = $this->disk->get('path', ''); // Variable needed for empty() test
        if (empty($path)) {
            $this->disk->set('path', _PS_MODULE_DIR_ . DIRECTORY_SEPARATOR . $this->attributes->get('name'));
        }
        // End of temporary content
        
        if(file_exists($this->disk->get('path') . DIRECTORY_SEPARATOR . $this->attributes->get('name') . '.php')) {
            require_once $this->disk->get('path') . DIRECTORY_SEPARATOR . $this->attributes->get('name') . '.php';
             $this->instance = LegacyModule::getInstanceByName($this->attributes->get('name'));
        }
        
       
    }

Hope this helps

×
×
  • Create New...