Fix Folder::tree() when excluding dot files or folders.

When 'exclude' param is array('.') files/folders are not skipped. Added test.
This commit is contained in:
Majna 2012-02-17 20:46:52 +01:00
parent 1dbafe1d4f
commit c40d132f81
2 changed files with 4 additions and 5 deletions

View file

@ -476,6 +476,9 @@ class FolderTest extends CakeTestCase {
$result = $Folder->tree(null, true);
$this->assertEquals($expected, $result);
$result = $Folder->tree(null, array('.'));
$this->assertEquals($expected, $result);
$expected = array(
array(
$Folder->path,

View file

@ -413,10 +413,6 @@ class Folder {
if (is_array($exceptions)) {
$exceptions = array_flip($exceptions);
if (isset($exceptions['.'])) {
$skipHidden = true;
unset($exceptions['.']);
}
}
$skipHidden = false;
if ($exceptions === true) {
@ -435,7 +431,7 @@ class Folder {
}
return array();
}
$pathLength = strlen($path);
foreach ($iterator as $itemPath => $fsIterator) {
if ($skipHidden) {
$subPathName = $fsIterator->getSubPathname();