Jump to content
cedib

PHP warning on ModuleFrontControllerCore

Recommended Posts

Hi,

I keep having this warning in the console for a Prestashop 1.6.1.24 on PHP 7.1:

PHP Warning:  Declaration of ModuleFrontControllerCore::setTemplate($template) should be compatible with FrontController::setTemplate($default_template, $layout = NULL) in /home/dgyhqty/public_html/classes/controller/ModuleFrontController.php on line 30

Does anyone know what it means?

Thanks

Share this post


Link to post
Share on other sites

You have a modification at function setTemplate() from /classes/controller/FrontController.php, it should be:

public function setTemplate($default_template)
{
    if ($this->useMobileTheme()) {
        $this->setMobileTemplate($default_template);
    } else {
        $template = $this->getOverrideTemplate();
        if ($template) {
            parent::setTemplate($template);
        } else {
            parent::setTemplate($default_template);
        }
    }
}

Someone has modified the core.

Share this post


Link to post
Share on other sites

This is what I have in the file. It's not modified. I've actually replaced it with a fresh one from a new download on prestashop.com to check if indeed the core file was modified. But it appears it's not the case.

Share this post


Link to post
Share on other sites

I have 2 overrides in the Override folder:

File ModuleFrontController.php:

class ModuleFrontController extends ModuleFrontControllerCore {

  public function setTemplate($template, $layout = null) {
    if (!$path = $this->getTemplatePath($template))
      throw new PrestaShopException("Template '$template' not found");

    $this->template = $path;
  }

}

And file FrontController.php that includes:

  public function setTemplate($default_template, $layout = null) {
    $this->_layout = $layout;

    if ($layout === false) {
      $this->display_header = false;
      $this->display_footer = false;
    }

    return parent::setTemplate($default_template);
  }

Could it be one of them? But I don't what they are for, they were put there by previous developers.

Share this post


Link to post
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

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More