diff --git a/src/Symfony/Components/Finder/Iterator/LimitDepthFilterIterator.php b/src/Symfony/Components/Finder/Iterator/LimitDepthFilterIterator.php index 3c2196a2f2..1befe53923 100644 --- a/src/Symfony/Components/Finder/Iterator/LimitDepthFilterIterator.php +++ b/src/Symfony/Components/Finder/Iterator/LimitDepthFilterIterator.php @@ -50,7 +50,7 @@ class LimitDepthFilterIterator extends \FilterIterator { $fileinfo = $this->getInnerIterator()->current(); - $depth = substr_count(str_replace('\\', '/', $fileinfo->getPath()), '/') - substr_count(str_replace('\\', '/', $this->baseDir->getPathname()), '/'); + $depth = substr_count($fileinfo->getPath(), DIRECTORY_SEPARATOR) - substr_count($this->baseDir->getPathname(), DIRECTORY_SEPARATOR); if ($depth > $this->maxDepth) {