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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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