- bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56

This commit is contained in:
Uwe Tews
2015-06-18 01:46:35 +02:00
parent 52ced72361
commit 7b469c1f4a
3 changed files with 7 additions and 7 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.26-dev===== (xx.xx.2015)
18.06.2015
- bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
17.06.2015
- bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.26-dev/1';
const SMARTY_VERSION = '3.1.26-dev/2';
/**
* define variable scopes

View File

@@ -17,9 +17,6 @@
*/
class Smarty_Internal_Resource_File extends Smarty_Resource
{
private $dsMap = array('/' => array(array('\\', '/./'), '/.'), '\\' => array(array('/', '\\.\\'), '\\.'));
/**
* build template filepath by traversing the template_dir array
*
@@ -127,9 +124,9 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
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;
}