Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit c27f4a7

Browse files
committed
normalize path
1 parent 71de169 commit c27f4a7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

PHPUnit_Smarty.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ public static function tearDownAfterClass()
103103
*/
104104
public function __construct($name = null, array $data = array(), $dataName = '')
105105
{
106+
if (!defined('individualFolders')) {
107+
define('individualFolders', true);
108+
}
106109
parent::__construct($name, $data, $dataName);
107110
$this->backupStaticAttributesBlacklist[get_class($this)] = array('init', 'config', 'pdo');
108111
}
@@ -369,9 +372,9 @@ public function normalizePath($path) {
369372
if ($path[0] == '.') {
370373
$path = getcwd() . DS . $path;
371374
}
372-
$path = preg_replace('#[\\\/]+([.][\\\/]+)*([.](?![.]))?#', DS, $path);
373-
while (strrpos($path, DS . '.') !== false) {
374-
$path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/]?)#', DS, $path);
375+
$path = preg_replace('#[\\\/]+([.][\\\/]+)*#', DS, $path);
376+
while (strrpos($path, '.' . DS) !== false) {
377+
$path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, $path);
375378
}
376379
return $path;
377380
}

0 commit comments

Comments
 (0)