Skip to content

Commit

Permalink
- bugfix allow windows network filepath or wrapper (forum topic 25876)
Browse files Browse the repository at this point in the history
  • Loading branch information
uwetews committed Jan 28, 2016
1 parent 4168481 commit 193163b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)
28.01.2016
- bugfix allow windows network filepath or wrapper (forum topic 25876) https://github.com/smarty-php/smarty/issues/170

27.01.2016
- revert bugfix compiling {section} did create warning
- bugfix {$smarty.section.customer.loop} did throw compiler error https://github.com/smarty-php/smarty/issues/161
Expand Down
15 changes: 7 additions & 8 deletions libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.30-dev/25';
const SMARTY_VERSION = '3.1.30-dev/27';

/**
* define variable scopes
Expand Down Expand Up @@ -1144,10 +1144,12 @@ public function _realpath($path, $realpath = null)
if (strpos($path, $nds) !== false) {
$path = str_replace($nds, DS, $path);
}
if (DS != '/' && $path[ 0 ] == DS) {
$path = substr(getcwd(), 0, 2) . $path;
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%', $path, $parts);
$path = $parts['path'];
if ($parts['root'] == '\\') {
$parts['root'] = substr(getcwd(), 0, 2) . $parts['root'];
} else {
if ($realpath !== null && $path[ 0 ] != '/' && $path[ 1 ] != ':') {
if ($realpath !== null && !$parts['root']) {
$path = getcwd() . DS . $path;
}
}
Expand All @@ -1157,10 +1159,7 @@ public function _realpath($path, $realpath = null)
preg_replace('#([\\\\/][^\\\\/]+[\\\\/]([.]?[\\\\/])*[.][.][\\\\/]([.]?[\\\\/])*)+|([\\\\/]([.]?[\\\\/])+)#',
DS, $path, - 1, $count);
}
if ($realpath === false && ($path[ 0 ] == '/' || $path[ 1 ] == ':')) {
$path = str_ireplace(getcwd(), '.', $path);
}
return $path;
return $parts['root'] . $path;
}

/**
Expand Down

0 comments on commit 193163b

Please sign in to comment.