Jump to content

classes/module/Module.php line 2509


Puriom

Recommended Posts

Hello!
My about 10th PS installation among last years, first time such a message in completely fresh install:
 

Quote

Warning on line 2509 in file /var/www/vhosts/MY X SITE.link/classes/module/Module.php
[2] file_exists(): open_basedir restriction in effect. File(/views/templates/hook/HookDashboardZoneTwo.tpl) is not within the allowed path(s): (/var/www/vhosts/MY X SITE.link/:/tmp/)

It came after a fatal error when installing "PrestaShop Account" module, which gave a fatal error (500) and I had to rename modules/ps_accounts. That brought back the backoffice but with the above issue.

I have Php v7.4.27


I added Lets Encrypt just to be able to see the site (is there any other way?) and the only other modules I have are the few basics (p.e. 1click, etc). I used Plesk automatic installation and I updated it with 1-click update.

(I found this but I cannot use it.
https://github.com/PrestaShop/PrestaShop/issues/26783
 

These are my 2504-2512 lines

}

        if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) {
            if (false === strpos($template, 'module:') &&
                !file_exists(_PS_ROOT_DIR_ . '/' . $template) &&
                !file_exists($template)
            ) {
                $template = $this->getTemplatePath($template);
            }


How it should be?)

Thank you for any Kind help

Link to comment
Share on other sites

  • 3 weeks later...

I have the same warning on 1.7.8.3 (php 7.4)

I have tried a new clean installation and the same warning happens to me with the debugging mode activated. 🤔

It seems as if it does not redirect well in the hosting subdomain.

Any ideas?🙄

Link to comment
Share on other sites

14 minutes ago, MarioCM said:

I have the same warning on 1.7.8.3 (php 7.4)

I have tried a new clean installation and the same warning happens to me with the debugging mode activated. 🤔

It seems as if it does not redirect well in the hosting subdomain.

Any ideas?🙄

Hello.

Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php

on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me):

 

protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
{

    if ($compile_id === null) {
        $compile_id = $this->getDefaultCompileId();
    }

    if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) {
        if (false === strpos($template, 'module:') &&
            !file_exists(_PS_ROOT_DIR_ . '/' . $template) &&
            !file_exists(_PS_ROOT_DIR_ . $template)
        ) {
            $template = $this->getTemplatePath($template);
        }

        $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate(
            $template,
            $cache_id,
            $compile_id,
            $this->smarty
        );
    }

    return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id];
}`

 

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...
  • 8 months later...
On 3/3/2022 at 5:27 PM, Puriom said:

Hello.

Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php

on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me):

 

protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
{

    if ($compile_id === null) {
        $compile_id = $this->getDefaultCompileId();
    }

    if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) {
        if (false === strpos($template, 'module:') &&
            !file_exists(_PS_ROOT_DIR_ . '/' . $template) &&
            !file_exists(_PS_ROOT_DIR_ . $template)
        ) {
            $template = $this->getTemplatePath($template);
        }

        $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate(
            $template,
            $cache_id,
            $compile_id,
            $this->smarty
        );
    }

    return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id];
}`

 

I've been looking for this for hours! Much thanks!!!!

Link to comment
Share on other sites

  • 1 year later...
On 03/03/2022 at 5:27 PM, Puriom dice:

Hello.

Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php

on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me):

 

protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
{

    if ($compile_id === null) {
        $compile_id = $this->getDefaultCompileId();
    }

    if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) {
        if (false === strpos($template, 'module:') &&
            !file_exists(_PS_ROOT_DIR_ . '/' . $template) &&
            !file_exists(_PS_ROOT_DIR_ . $template)
        ) {
            $template = $this->getTemplatePath($template);
        }

        $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate(
            $template,
            $cache_id,
            $compile_id,
            $this->smarty
        );
    }

    return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id];
}`

 

This is supposed to works on PS8.1 too?

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...