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


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


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


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

0 comments on commit 2c239cc

Please sign in to comment.