- bugfix Smarty version was not filled in header comment of compiled and cached files

- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR (reverted from commit 1e787d08f1)
This commit is contained in:
Uwe Tews
2017-10-26 04:18:28 +02:00
parent 1e787d08f1
commit 42a292d56a
10 changed files with 348 additions and 309 deletions
@@ -21,42 +21,49 @@ class Smarty_Internal_Runtime_GetIncludePath
* @var string
*/
public $_include_path = '';
/**
* include path directory cache
*
* @var array
*/
public $_include_dirs = array();
/**
* include path directory cache
*
* @var array
*/
public $_user_dirs = array();
/**
* stream cache
*
* @var string[]
*/
public $isFile = array();
/**
* stream cache
*
* @var string[]
*/
public $isPath = array();
/**
* stream cache
*
* @var int[]
*/
public $number = array();
/**
* status cache
*
* @var bool
*/
public $_has_stream_include = null;
/**
* Number for array index
*
@@ -74,13 +81,13 @@ class Smarty_Internal_Runtime_GetIncludePath
public function isNewIncludePath(Smarty $smarty)
{
$_i_path = get_include_path();
if ($this->_include_path !== $_i_path) {
if ($this->_include_path != $_i_path) {
$this->_include_dirs = array();
$this->_include_path = $_i_path;
$_dirs = (array)explode(PATH_SEPARATOR, $_i_path);
$_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
foreach ($_dirs as $_path) {
if (is_dir($_path)) {
$this->_include_dirs[] = $smarty->_realpath($_path . DIRECTORY_SEPARATOR, true);
$this->_include_dirs[] = $smarty->_realpath($_path . $smarty->ds, true);
}
}
return true;
@@ -121,7 +128,7 @@ class Smarty_Internal_Runtime_GetIncludePath
}
// try PHP include_path
foreach ($dirs as $dir) {
$dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter++;
$dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter ++;
if (isset($this->isFile[ $dir_n ][ $file ])) {
if ($this->isFile[ $dir_n ][ $file ]) {
return $this->isFile[ $dir_n ][ $file ];
@@ -136,9 +143,9 @@ class Smarty_Internal_Runtime_GetIncludePath
$dir = $this->_user_dirs[ $dir_n ];
}
} else {
if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') {
if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
$dir = str_ireplace(getcwd(), '.', $dir);
if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') {
if ($dir[ 0 ] == '/' || $dir[ 1 ] == ':') {
$this->_user_dirs[ $dir_n ] = false;
continue;
}