From e5b3da5b387b5abbcfe67b5b7083927161ea716d Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Thu, 18 Jun 2015 00:17:57 +0200 Subject: [PATCH] Update path normalization --- tests/PHPUnit_Smarty.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/PHPUnit_Smarty.php b/tests/PHPUnit_Smarty.php index f2539862..4aca9a27 100644 --- a/tests/PHPUnit_Smarty.php +++ b/tests/PHPUnit_Smarty.php @@ -74,9 +74,6 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase 'PHPUnit_Smarty' => array('config', 'pdo', 'init'), ); - private $dsMap = array('/' => array(array('\\', '/./'), '/.'), - '\\' => array(array('/', '\\.\\'), '\\.'), - ); /** * This method is called before the first test of this test class is run. @@ -372,9 +369,9 @@ KEY `expire` (`expire`) if ($path[0] == '.') { $path = getcwd() . DS . $path; } - $path = str_replace($this->dsMap[DS][0], DS, $path); - while (strrpos($path, $this->dsMap[DS][1]) !== false) { - $path = preg_replace('#([\\\/][.][\\\/])|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, $path); + $path = preg_replace('#[\\\/]+([.][\\\/]+)*([.](?![.]))?#', DS, $path); + while (strrpos($path, DS . '.') !== false) { + $path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/]?)#', DS, $path); } return $path; }