From c95d3f3a4d088dae2c62d713c5fb86bfc226dbed Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Tue, 24 Apr 2018 11:33:47 +0200 Subject: [PATCH] - fix compatibility for PHP version < 5.6 --- libs/Smarty.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index aba24441..0ce8fdea 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1042,10 +1042,16 @@ class Smarty extends Smarty_Internal_TemplateBase */ 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] !== '\\') {