Skip to content

Commit 730b01b

Browse files
Revert fix for sebastianbergmann#30
1 parent 3d478c5 commit 730b01b

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

Diff for: ChangeLog.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [1.4.5] - 2017-11-27
6+
7+
### Fixed
8+
9+
* Fixed [#37](https://github.com/sebastianbergmann/php-file-iterator/issues/37): Regression caused by fix for [#30](https://github.com/sebastianbergmann/php-file-iterator/issues/30)
10+
511
## [1.4.4] - 2017-11-27
612

713
### Fixed
@@ -28,6 +34,7 @@ No changes
2834

2935
* [Added support for wildcards (glob) in exclude](https://github.com/sebastianbergmann/php-file-iterator/pull/23)
3036

37+
[1.4.5]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.4...1.4.5
3138
[1.4.4]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.3...1.4.4
3239
[1.4.3]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.2...1.4.3
3340
[1.4.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.1...1.4.2

Diff for: src/Iterator.php

-29
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class File_Iterator extends FilterIterator
3939
*/
4040
protected $basepath;
4141

42-
/**
43-
* @var bool
44-
*/
45-
private $excludeAll = FALSE;
46-
4742
/**
4843
* @param Iterator $iterator
4944
* @param array $suffixes
@@ -63,11 +58,6 @@ public function __construct(Iterator $iterator, array $suffixes = array(), array
6358
$basepath = NULL;
6459
} else {
6560
foreach ($exclude as &$_exclude) {
66-
if (self::isExcludeParentOrSame($_exclude, $basepath)) {
67-
$this->excludeAll = TRUE;
68-
continue;
69-
}
70-
7161
$_exclude = str_replace($basepath, '', $_exclude);
7262
}
7363
}
@@ -110,10 +100,6 @@ public function accept()
110100
*/
111101
protected function acceptPath($path)
112102
{
113-
if ($this->excludeAll) {
114-
return FALSE;
115-
}
116-
117103
foreach ($this->exclude as $exclude) {
118104
if (strpos($path, $exclude) === 0) {
119105
return FALSE;
@@ -169,19 +155,4 @@ protected function acceptSubString($filename, array $subStrings, $type)
169155

170156
return $matched;
171157
}
172-
173-
private static function isExcludeParentOrSame($exclude, $basepath)
174-
{
175-
if ($exclude === $basepath) {
176-
return TRUE;
177-
}
178-
179-
$excludeWithSeparator = $exclude . DIRECTORY_SEPARATOR;
180-
$prefixLength = strlen($excludeWithSeparator);
181-
if ($excludeWithSeparator === substr($basepath, 0, $prefixLength)) {
182-
return TRUE;
183-
}
184-
185-
return FALSE;
186-
}
187158
}

0 commit comments

Comments
 (0)