Skip to content

Commit

Permalink
- fix compatibility for PHP version < 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Tews committed Apr 24, 2018
1 parent 8d21f38 commit c95d3f3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,16 @@ public function _getTemplateId($template_name,
*/
public function _realpath($path, $realpath = null)
{
static $nds = array('/' => '\\', '\\' => '/');
static $sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR;
static $sepDot = DIRECTORY_SEPARATOR . '.';
static $sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
static $nds = null;
static $sepDotsep = null;
static $sepDot = null;
static $sepSep =null;
if (!isset($nds)) {
$nds = array('/' => '\\', '\\' => '/');
$sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR;
$sepDot = DIRECTORY_SEPARATOR . '.';
$sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
}
// normalize DIRECTORY_SEPARATOR
$path = str_replace(array($nds[DIRECTORY_SEPARATOR], $sepDotsep), DIRECTORY_SEPARATOR, $path);
if (strpos($path,$sepDot) === false && (($realpath === false && $path[0] === '.') || $realpath === null) && $path[0] !== '\\') {
Expand Down

0 comments on commit c95d3f3

Please sign in to comment.