mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix a filepath starting with '/' or '\' on windows should normalize to the root dir
of current working drive https://github.com/smarty-php/smarty/issues/134
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
21.12.2015
|
||||
- bugfix a filepath starting with '/' or '\' on windows should normalize to the root dir
|
||||
of current working drive https://github.com/smarty-php/smarty/issues/134
|
||||
|
||||
===== 3.1.29 ===== (21.12.2015)
|
||||
21.12.2015
|
||||
- optimization improve speed of filetime checks on extends and extendsall resource
|
||||
|
@@ -118,7 +118,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.30-dev';
|
||||
const SMARTY_VERSION = '3.1.30-dev/1';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@@ -1076,10 +1076,11 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
} else {
|
||||
$data = null;
|
||||
}
|
||||
if ($this->caching &&
|
||||
isset($this->_cache['isCached'][$_templateId = $this->_getTemplateId($template, $cache_id, $compile_id)])
|
||||
if ($this->caching && isset($this->_cache[ 'isCached' ][ $_templateId =
|
||||
$this->_getTemplateId($template, $cache_id, $compile_id) ])
|
||||
) {
|
||||
$tpl = $do_clone ? clone $this->_cache['isCached'][$_templateId] : $this->_cache['isCached'][$_templateId];
|
||||
$tpl = $do_clone ? clone $this->_cache[ 'isCached' ][ $_templateId ] :
|
||||
$this->_cache[ 'isCached' ][ $_templateId ];
|
||||
$tpl->parent = $parent;
|
||||
$tpl->tpl_vars = array();
|
||||
$tpl->config_vars = array();
|
||||
@@ -1159,7 +1160,9 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
* - make it absolute if required
|
||||
*
|
||||
* @param string $path file path
|
||||
* @param bool $realpath leave $path relative
|
||||
* @param bool $realpath if true - convert to absolute
|
||||
* false - convert to relative
|
||||
* null - keep as it is but remove /./ /../
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -1178,9 +1181,13 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
$path = str_replace($nds, DS, $path);
|
||||
}
|
||||
|
||||
if ($realpath === true && (($path[0] !== '/' && DS == '/') || ($path[1] !== ':' && DS != '/'))) {
|
||||
if (DS != '/' && $path[ 0 ] == DS) {
|
||||
$path = substr(getcwd(), 0, 2) . $path;
|
||||
} else {
|
||||
if ($realpath === true && $path[ 0 ] !== '/' && $path[ 1 ] !== ':') {
|
||||
$path = getcwd() . DS . $path;
|
||||
}
|
||||
}
|
||||
while ((strpos($path, '.' . DS) !== false) || (strpos($path, DS . DS) !== false)) {
|
||||
$path = preg_replace($pattern, DS, $path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user