Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replace INF to PHP_INT_MAX inside Finder component.

bug issue introduced by 7c66dffa6b
  • Loading branch information...
commit c67f01a50fea3c2897a74ebbb64e3f7d83728d0f 1 parent c4deda0
Benoit Leveque authored
View
4 Adapter/AbstractAdapter.php
@@ -21,7 +21,7 @@
protected $followLinks = false;
protected $mode = 0;
protected $minDepth = 0;
- protected $maxDepth = INF;
+ protected $maxDepth = PHP_INT_MAX;
protected $exclude = array();
protected $names = array();
protected $notNames = array();
@@ -76,7 +76,7 @@ public function setMode($mode)
public function setDepths(array $depths)
{
$this->minDepth = 0;
- $this->maxDepth = INF;
+ $this->maxDepth = PHP_INT_MAX;
foreach ($depths as $comparator) {
switch ($comparator->getOperator()) {
View
5 Adapter/AbstractFindAdapter.php
@@ -60,9 +60,8 @@ public function searchInDirectory($dir)
}
$find->add('-mindepth')->add($this->minDepth + 1);
- // warning! INF < INF => true ; INF == INF => false ; INF === INF => true
- // https://bugs.php.net/bug.php?id=9118
- if (INF !== $this->maxDepth) {
+
+ if (PHP_INT_MAX !== $this->maxDepth) {
$find->add('-maxdepth')->add($this->maxDepth + 1);
}
View
2  Adapter/PhpAdapter.php
@@ -36,7 +36,7 @@ public function searchInDirectory($dir)
\RecursiveIteratorIterator::SELF_FIRST
);
- if ($this->minDepth > 0 || $this->maxDepth < INF) {
+ if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
$iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
}
View
2  Iterator/DepthRangeFilterIterator.php
@@ -27,7 +27,7 @@ class DepthRangeFilterIterator extends FilterIterator
* @param int $minDepth The min depth
* @param int $maxDepth The max depth
*/
- public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = INF)
+ public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
{
$this->minDepth = $minDepth;
$iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
View
4 Tests/Iterator/DepthRangeFilterIteratorTest.php
@@ -72,8 +72,8 @@ public function getAcceptData()
return array(
array(0, 0, $this->toAbsolute($lessThan1)),
array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
- array(2, INF, array()),
- array(1, INF, $this->toAbsolute($graterThanOrEqualTo1)),
+ array(2, PHP_INT_MAX, array()),
+ array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
array(1, 1, $this->toAbsolute($equalTo1)),
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.