Skip to content

Commit ee3259d

Browse files
committed
Add quoting for base path in di compile command
1 parent 274971a commit ee3259d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private function getExcludedModulePaths(array $modulePaths)
239239
$vendorPathsRegExps[] = $vendorDir
240240
. '/(?:' . join('|', $vendorModules) . ')';
241241
}
242-
$basePathsRegExps[] = $basePath
242+
$basePathsRegExps[] = preg_quote($basePath, '#')
243243
. '/(?:' . join('|', $vendorPathsRegExps) . ')';
244244
}
245245

@@ -258,6 +258,10 @@ private function getExcludedModulePaths(array $modulePaths)
258258
*/
259259
private function getExcludedLibraryPaths(array $libraryPaths)
260260
{
261+
$libraryPaths = array_map(function ($libraryPath) {
262+
return preg_quote($libraryPath, '#');
263+
}, $libraryPaths);
264+
261265
$excludedLibraryPaths = [
262266
'#^(?:' . join('|', $libraryPaths) . ')/([\\w]+/)?Test#',
263267
'#^(?:' . join('|', $libraryPaths) . ')/([\\w]+/)?tests#',
@@ -274,7 +278,7 @@ private function getExcludedLibraryPaths(array $libraryPaths)
274278
private function getExcludedSetupPaths($setupPath)
275279
{
276280
return [
277-
'#^(?:' . $setupPath . ')(/[\\w]+)*/Test#'
281+
'#^(?:' . preg_quote($setupPath, '#') . ')(/[\\w]+)*/Test#'
278282
];
279283
}
280284

0 commit comments

Comments
 (0)