X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Ffinder%2FGlob.php;h=27d9ce3d11938da65ea8e5ef89504274566f2c57;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=953a0b3e9004b3e33a5ea7d833cdabd022b40da1;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/finder/Glob.php b/vendor/symfony/finder/Glob.php index 953a0b3e9..27d9ce3d1 100644 --- a/vendor/symfony/finder/Glob.php +++ b/vendor/symfony/finder/Glob.php @@ -14,14 +14,14 @@ namespace Symfony\Component\Finder; /** * Glob matches globbing patterns against text. * - * if match_glob("foo.*", "foo.bar") echo "matched\n"; + * if match_glob("foo.*", "foo.bar") echo "matched\n"; * - * // prints foo.bar and foo.baz - * $regex = glob_to_regex("foo.*"); - * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) - * { - * if (/$regex/) echo "matched: $car\n"; - * } + * // prints foo.bar and foo.baz + * $regex = glob_to_regex("foo.*"); + * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) + * { + * if (/$regex/) echo "matched: $car\n"; + * } * * Glob implements glob(3) style matching that can be used to match * against text, rather than fetching names from a filesystem. @@ -51,19 +51,31 @@ class Glob $escaping = false; $inCurlies = 0; $regex = ''; - $sizeGlob = strlen($glob); + $sizeGlob = \strlen($glob); for ($i = 0; $i < $sizeGlob; ++$i) { $car = $glob[$i]; - if ($firstByte) { - if ($strictLeadingDot && '.' !== $car) { - $regex .= '(?=[^\.])'; + if ($firstByte && $strictLeadingDot && '.' !== $car) { + $regex .= '(?=[^\.])'; + } + + $firstByte = '/' === $car; + + if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) { + $car = '[^/]++/'; + if (!isset($glob[$i + 3])) { + $car .= '?'; } - $firstByte = false; - } + if ($strictLeadingDot) { + $car = '(?=[^\.])'.$car; + } + + $car = '/(?:'.$car.')*'; + $i += 2 + isset($glob[$i + 3]); - if ('/' === $car) { - $firstByte = true; + if ('/' === $delimiter) { + $car = str_replace('/', '\\/', $car); + } } if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {