Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.2][Finder] fix assets:install issue #7341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
replace INF to PHP_INT_MAX inside Finder component.
bug issue introduced by 7c66dff
  • Loading branch information
Benoit Leveque committed Mar 12, 2013
commit 602cdeeaed888660bb1cee72917f0537812b22a1
4 changes: 2 additions & 2 deletions src/Symfony/Component/Finder/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractAdapter implements AdapterInterface
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();
Expand Down Expand Up @@ -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()) {
Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Finder/Adapter/PhpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
);
}
Expand Down