mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 05:45:33 +08:00
pull origin
This commit is contained in:
@@ -27,6 +27,7 @@ class BaseFileHelper
|
||||
const PATTERN_MUSTBEDIR = 8;
|
||||
const PATTERN_NEGATIVE = 16;
|
||||
|
||||
|
||||
/**
|
||||
* Normalizes a file/directory path.
|
||||
* The normalization does the following work:
|
||||
@@ -42,7 +43,7 @@ class BaseFileHelper
|
||||
*/
|
||||
public static function normalizePath($path, $ds = DIRECTORY_SEPARATOR)
|
||||
{
|
||||
$path = rtrim(strtr($path, ['/' => $ds, '\\' => $ds]), $ds);
|
||||
$path = rtrim(strtr($path, '/\\', $ds . $ds), $ds);
|
||||
if (strpos($ds . $path, "{$ds}.") === false && strpos($path, "{$ds}{$ds}") === false) {
|
||||
return $path;
|
||||
}
|
||||
@@ -602,10 +603,8 @@ class BaseFileHelper
|
||||
$result['flags'] |= self::PATTERN_NEGATIVE;
|
||||
$pattern = StringHelper::byteSubstr($pattern, 1, StringHelper::byteLength($pattern));
|
||||
}
|
||||
$len = StringHelper::byteLength($pattern);
|
||||
if ($len && StringHelper::byteSubstr($pattern, -1, 1) == '/') {
|
||||
if (StringHelper::byteLength($pattern) && StringHelper::byteSubstr($pattern, -1, 1) == '/') {
|
||||
$pattern = StringHelper::byteSubstr($pattern, 0, -1);
|
||||
$len--;
|
||||
$result['flags'] |= self::PATTERN_MUSTBEDIR;
|
||||
}
|
||||
if (strpos($pattern, '/') === false) {
|
||||
|
||||
Reference in New Issue
Block a user