mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user