Jump to content

PHP warning on ModuleFrontControllerCore


cedib

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

Link to comment
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.

Link to comment
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.

Link to comment
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...