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

Skip to content

Commit 82a78ed

Browse files
committed
merged branch BenoitLeveque/assets-install-finder-issue (PR #7341)
This PR was merged into the 2.2 branch. Commits ------- 602cdee replace INF to PHP_INT_MAX inside Finder component. Discussion ---------- [2.2][Finder] fix assets:install issue I have some bundle with assets, and when i do. ``` app/console assets:install --env=prod ``` I don't have any of my file inside web/bundles, only empty first level directory like "css" bug issue introduced by 7c66dff --------------------------------------------------------------------------- by fabpot at 2013-03-13T13:34:10Z Can you base your patch on the 2.1 branch as the bug is also there? Thanks. --------------------------------------------------------------------------- by BenoitLeveque at 2013-03-13T14:29:55Z i didn't reproduce this issue on the latest commit (175cdc0) on 2.1 branch --------------------------------------------------------------------------- by taylorotwell at 2013-03-13T14:35:28Z Yeah, it appears the Finder component's recursion is basically broken on the 2.2 branch. --------------------------------------------------------------------------- by BenoitLeveque at 2013-03-14T13:24:52Z @fabpot i can't reproduce this issue on the 2.1 branch because you already fix it, see 7241be9
2 parents 7966d8f + 602cdee commit 82a78ed

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

src/Symfony/Component/Finder/Adapter/AbstractAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class AbstractAdapter implements AdapterInterface
2121
protected $followLinks = false;
2222
protected $mode = 0;
2323
protected $minDepth = 0;
24-
protected $maxDepth = INF;
24+
protected $maxDepth = PHP_INT_MAX;
2525
protected $exclude = array();
2626
protected $names = array();
2727
protected $notNames = array();
@@ -76,7 +76,7 @@ public function setMode($mode)
7676
public function setDepths(array $depths)
7777
{
7878
$this->minDepth = 0;
79-
$this->maxDepth = INF;
79+
$this->maxDepth = PHP_INT_MAX;
8080

8181
foreach ($depths as $comparator) {
8282
switch ($comparator->getOperator()) {

src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ public function searchInDirectory($dir)
6060
}
6161

6262
$find->add('-mindepth')->add($this->minDepth + 1);
63-
// warning! INF < INF => true ; INF == INF => false ; INF === INF => true
64-
// https://bugs.php.net/bug.php?id=9118
65-
if (INF !== $this->maxDepth) {
63+
64+
if (PHP_INT_MAX !== $this->maxDepth) {
6665
$find->add('-maxdepth')->add($this->maxDepth + 1);
6766
}
6867

src/Symfony/Component/Finder/Adapter/PhpAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function searchInDirectory($dir)
3636
\RecursiveIteratorIterator::SELF_FIRST
3737
);
3838

39-
if ($this->minDepth > 0 || $this->maxDepth < INF) {
39+
if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
4040
$iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
4141
}
4242

src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DepthRangeFilterIterator extends FilterIterator
2727
* @param int $minDepth The min depth
2828
* @param int $maxDepth The max depth
2929
*/
30-
public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = INF)
30+
public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
3131
{
3232
$this->minDepth = $minDepth;
3333
$iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);

src/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function getAcceptData()
7272
return array(
7373
array(0, 0, $this->toAbsolute($lessThan1)),
7474
array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
75-
array(2, INF, array()),
76-
array(1, INF, $this->toAbsolute($graterThanOrEqualTo1)),
75+
array(2, PHP_INT_MAX, array()),
76+
array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
7777
array(1, 1, $this->toAbsolute($equalTo1)),
7878
);
7979
}

0 commit comments

Comments
 (0)