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 by7c66dffa6b
--------------------------------------------------------------------------- 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 (175cdc0fd0
) 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, see7241be9b64
This commit is contained in:
commit
82a78ed545
@ -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();
|
||||
@ -76,7 +76,7 @@ abstract class AbstractAdapter implements AdapterInterface
|
||||
public function setDepths(array $depths)
|
||||
{
|
||||
$this->minDepth = 0;
|
||||
$this->maxDepth = INF;
|
||||
$this->maxDepth = PHP_INT_MAX;
|
||||
|
||||
foreach ($depths as $comparator) {
|
||||
switch ($comparator->getOperator()) {
|
||||
|
@ -60,9 +60,8 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class PhpAdapter extends AbstractAdapter
|
||||
\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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -72,8 +72,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
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)),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user