Skip to content

Commit

Permalink
Fixes for -1 values in php.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
MirazMac committed Nov 5, 2021
1 parent 06398ed commit 4441262
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ public function validateIniRequirement()
$newcfg = $this->returnBytes($setting);
$newval = $this->returnBytes($value);


$data['satisfied'] = $this->looseComparison($newcfg, $operator, $newval);

// Acknowledge '-1'(unlimited) values
// @see https://github.com/MirazMac/php-requirements-checker/issues/2
$data['satisfied'] = ($setting == '-1') ? true : $this->looseComparison($newcfg, $operator, $newval);

if (!$data['satisfied']) {
$this->satisfied = false;
Expand Down
12 changes: 12 additions & 0 deletions tests/ChekerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public function testClassesFail()
$this->assertEquals(false, $this->checker->isSatisfied());
}

public function testUnlimitedIniValuePass()
{
ini_set('memory_limit', -1);

$this->checker->resetRequirements();
$this->checker->requireIniValues([
'memory_limit' => '>=64M',
]);

$this->assertEquals(true, $this->checker->isSatisfied());
}


/**
* @dataProvider phpVersionPassData
Expand Down

0 comments on commit 4441262

Please sign in to comment.