Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix exclusion when basepath is used.

  • Loading branch information...
commit e1e4ed04a335ee60fbcee20dc5da833648e9e8c9 1 parent 8f09322
Sebastian Bergmann authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 File/Iterator.php
16 File/Iterator.php
View
@@ -86,9 +86,23 @@ class File_Iterator extends FilterIterator
*/
public function __construct(Iterator $iterator, array $suffixes = array(), array $prefixes = array(), array $exclude = array(), $basepath = NULL)
{
+ $exclude = array_map('realpath', $exclude);
+
+ if ($basepath !== NULL) {
+ $basepath = realpath($basepath);
+ }
+
+ if ($basepath === FALSE) {
+ $basepath = NULL;
+ } else {
+ foreach ($exclude as &$_exclude) {
+ $_exclude = str_replace($basepath, '', $_exclude);
+ }
+ }
+
$this->prefixes = $prefixes;
$this->suffixes = $suffixes;
- $this->exclude = array_map('realpath', $exclude);
+ $this->exclude = $exclude;
$this->basepath = $basepath;
parent::__construct($iterator);
Please sign in to comment.
Something went wrong with that request. Please try again.