From 34531edb4ca39e00654f2b57fe14f721681377b7 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Thu, 18 Jun 2015 02:53:22 +0200 Subject: [PATCH] - bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 --- change_log.txt | 6 +++++- libs/sysplugins/smarty_internal_resource_file.php | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index a74e95e4..bdceaff9 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ - ===== 3.1.26===== (18.06.2015) + ===== 3.1.27-dev===== (xx.xx.2015) +18.06.2015 + - bugfix another update on file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 + + ===== 3.1.26===== (18.06.2015) 18.06.2015 - bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56 diff --git a/libs/sysplugins/smarty_internal_resource_file.php b/libs/sysplugins/smarty_internal_resource_file.php index e8fe9e6c..b34033dd 100644 --- a/libs/sysplugins/smarty_internal_resource_file.php +++ b/libs/sysplugins/smarty_internal_resource_file.php @@ -124,9 +124,9 @@ class Smarty_Internal_Resource_File extends Smarty_Resource if ($path[0] == '.') { $path = getcwd() . DS . $path; } - $path = preg_replace('#[\\\/]+([.][\\\/]+)*([.](?![.]))?#', DS, $path); - while (strrpos($path, DS . '.') !== false) { - $path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/]?)#', DS, $path); + $path = preg_replace('#[\\\/]+([.][\\\/]+)*#', DS, $path); + while (strrpos($path, '.' . DS) !== false) { + $path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, $path); } return $path; }