From d534588931cd5cf5242a8feb3894f242724dbc3a Mon Sep 17 00:00:00 2001 From: Web Helpers Pau <75366465+WebHelpersPau@users.noreply.github.com> Date: Mon, 25 Oct 2021 19:08:45 +0200 Subject: [PATCH] After install, the getAvailableTemplates() method , scandir find .php files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running scandir, the method getAvailableTemplates() get not only . and .. files, but also index.php This results in a warning about open_base_dir restrictions if set when running the following get_file_contents() Warning à la ligne 41 du fichier /var/www/PRESTASHOP/override/modules/ps_emailsmanager/ps_emailsmanager.php [2] file_exists(): open_basedir restriction in effect. File(/var/www/PRESTASHOP/modules/ps_emailsmanager/imports/index.php/settings.json) is not within the allowed path(s): (/var/www/PRESTASHOP:/tmp) --- ps_emailsmanager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index b6f4d78..90221aa 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -841,8 +841,8 @@ public function getAvailableTemplates() return $templates; } - //remove '.' and '..' from array - $templatesDir = array_diff($templatesDir, array('.', '..')); + //remove '.', '..' and 'index.php' from array + $templatesDir = array_diff($templatesDir, array('.', '..', 'index.php')); foreach ($templatesDir as $tpl) { $settings = $uploadDir.$tpl.DIRECTORY_SEPARATOR.'settings.json';