- bugfix remove constant DS as shortcut for DIRECTORY_SEPARATOR as the user may have defined it to something else https://github.com/smarty-php/smarty/issues/277

This commit is contained in:
uwetews
2016-08-23 08:03:39 +02:00
parent be39cc0121
commit 2003020df9
15 changed files with 51 additions and 48 deletions
+4 -4
View File
@@ -562,7 +562,7 @@ class Smarty_Security
unset($this->_resource_dir[ $directory ]);
}
foreach ((array) $this->secure_dir as $directory) {
$directory = $this->smarty->_realpath($directory . DS, true);
$directory = $this->smarty->_realpath($directory . DIRECTORY_SEPARATOR, true);
$this->_resource_dir[ $directory ] = true;
}
$this->_secure_dir = (array) $this->secure_dir;
@@ -618,7 +618,7 @@ class Smarty_Security
$this->_trusted_dir = $this->trusted_dir;
foreach ((array) $this->trusted_dir as $directory) {
$directory = $this->smarty->_realpath($directory . DS, true);
$directory = $this->smarty->_realpath($directory . DIRECTORY_SEPARATOR, true);
$this->_php_resource_dir[ $directory ] = true;
}
}
@@ -639,7 +639,7 @@ class Smarty_Security
*/
private function _checkDir($filepath, $dirs)
{
$directory = dirname($filepath) . DS;
$directory = dirname($filepath) . DIRECTORY_SEPARATOR;
$_directory = array();
while (true) {
// remember the directory to add it to _resource_dir in case we're successful
@@ -656,7 +656,7 @@ class Smarty_Security
break;
}
// bubble up one level
$directory = preg_replace('#[\\\/][^\\\/]+[\\\/]$#', DS, $directory);
$directory = preg_replace('#[\\\/][^\\\/]+[\\\/]$#', DIRECTORY_SEPARATOR, $directory);
}
// give up