- bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR

like C:/  at Smarty > 3.1.33-dev-5 https://github.com/smarty-php/smarty/issues/451
This commit is contained in:
uwetews
2018-08-31 16:07:47 +02:00
parent 7a8607fe17
commit 8a4a817c66
2 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
===== 3.1.33-dev-8 =====
===== 3.1.33-dev-9 =====
31.08.2018
- bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR
like C:/ at Smarty > 3.1.33-dev-5 https://github.com/smarty-php/smarty/issues/451
- PSR-2 code style fixes for config and template file Lexer/Parser generated with
the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer
https://github.com/smarty-php/smarty/pull/483

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.33-dev-8';
const SMARTY_VERSION = '3.1.33-dev-9';
/**
* define variable scopes
*/
@@ -1116,7 +1116,7 @@ class Smarty extends Smarty_Internal_TemplateBase
{
$nds = array('/' => '\\', '\\' => '/');
preg_match(
'%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
'%^(?<root>(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
$path,
$parts
);
@@ -1130,6 +1130,7 @@ class Smarty extends Smarty_Internal_TemplateBase
}
// normalize DIRECTORY_SEPARATOR
$path = str_replace($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR, $path);
$parts[ 'root' ] = str_replace($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR, $parts[ 'root' ]);
do {
$path = preg_replace(
array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),