From 8a4a817c667700610412738a160206e359400d67 Mon Sep 17 00:00:00 2001 From: uwetews Date: Fri, 31 Aug 2018 16:07:47 +0200 Subject: [PATCH] - 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 --- change_log.txt | 5 ++++- libs/Smarty.class.php | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/change_log.txt b/change_log.txt index 02ecf348..b7d7d6c6 100644 --- a/change_log.txt +++ b/change_log.txt @@ -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 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 766c38e1..137c9ca0 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -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( - '%^(?(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?(.*))$%u', + '%^(?(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?(.*))$%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}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),