mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
Update path normalization
This commit is contained in:
@@ -74,9 +74,6 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
|
|||||||
'PHPUnit_Smarty' => array('config', 'pdo', 'init'),
|
'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.
|
* This method is called before the first test of this test class is run.
|
||||||
@@ -372,9 +369,9 @@ KEY `expire` (`expire`)
|
|||||||
if ($path[0] == '.') {
|
if ($path[0] == '.') {
|
||||||
$path = getcwd() . DS . $path;
|
$path = getcwd() . DS . $path;
|
||||||
}
|
}
|
||||||
$path = str_replace($this->dsMap[DS][0], DS, $path);
|
$path = preg_replace('#[\\\/]+([.][\\\/]+)*([.](?![.]))?#', DS, $path);
|
||||||
while (strrpos($path, $this->dsMap[DS][1]) !== false) {
|
while (strrpos($path, DS . '.') !== false) {
|
||||||
$path = preg_replace('#([\\\/][.][\\\/])|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, $path);
|
$path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/]?)#', DS, $path);
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user