Skip to content

Commit

Permalink
- bugfix on Windows absolute filepathes did fail if the drive letter …
Browse files Browse the repository at this point in the history
…was followed by a linux DIRECTORY_SEPARATOR

    like C:/  at Smarty > 3.1.33-dev-5 #451
  • Loading branch information
uwetews committed Aug 31, 2018
1 parent 7a8607f commit 8a4a817
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion change_log.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -1116,7 +1116,7 @@ public function _realpath($path, $realpath = null)
{
$nds = array('/' => '\\', '\\' => '/');
preg_match(
'%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
'%^(?<root>(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
$path,
$parts
);
Expand All @@ -1130,6 +1130,7 @@ public function _realpath($path, $realpath = null)
}
// 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}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),
Expand Down

0 comments on commit 8a4a817

Please sign in to comment.