Skip to content

Commit

Permalink
Removed constant available only in php 5.3 and changed exception type…
Browse files Browse the repository at this point in the history
… to fix errors on php 5.2. Fixes #2487
  • Loading branch information
ADmad committed Jan 19, 2012
1 parent 5e495ad commit 2c239cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Cake/Utility/Folder.php
Expand Up @@ -154,7 +154,7 @@ public function read($sort = true, $exceptions = false, $fullPath = false) {

try {
$iterator = new DirectoryIterator($this->path);
} catch (UnexpectedValueException $e) {
} catch (Exception $e) {
return array($dirs, $files);
}

Expand Down Expand Up @@ -423,9 +423,9 @@ public function tree($path = null, $exceptions = true, $type = null) {
}

try {
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME | RecursiveDirectoryIterator::CURRENT_AS_SELF | RecursiveDirectoryIterator::SKIP_DOTS);
$directory = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME | RecursiveDirectoryIterator::CURRENT_AS_SELF);
$iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST);
} catch (UnexpectedValueException $e) {
} catch (Exception $e) {
if ($type === null) {
return array(array(), array());
}
Expand All @@ -446,7 +446,7 @@ public function tree($path = null, $exceptions = true, $type = null) {

if ($item->isFile()) {
$files[] = $itemPath;
} elseif ($item->isDir()) {
} elseif ($item->isDir() && !$item->isDot()) {
$directories[] = $itemPath;
}
}
Expand Down

0 comments on commit 2c239cc

Please sign in to comment.