1
0
Fork 0

Only load options when they come from the lock file, not from standard metadata, refs #2189

pull/2604/head
Jordi Boggiano 2014-05-07 18:12:26 +02:00
parent 016a016455
commit 31092843fd
3 changed files with 6 additions and 4 deletions

View File

@ -25,13 +25,15 @@ use Composer\Package\Version\VersionParser;
class ArrayLoader implements LoaderInterface class ArrayLoader implements LoaderInterface
{ {
protected $versionParser; protected $versionParser;
protected $loadOptions;
public function __construct(VersionParser $parser = null) public function __construct(VersionParser $parser = null, $loadOptions = false)
{ {
if (!$parser) { if (!$parser) {
$parser = new VersionParser; $parser = new VersionParser;
} }
$this->versionParser = $parser; $this->versionParser = $parser;
$this->loadOptions = $loadOptions;
} }
public function load(array $config, $class = 'Composer\Package\CompletePackage') public function load(array $config, $class = 'Composer\Package\CompletePackage')
@ -197,7 +199,7 @@ class ArrayLoader implements LoaderInterface
} }
} }
if (isset($config['options'])) { if ($this->loadOptions && isset($config['options'])) {
$package->setOptions($config['options']); $package->setOptions($config['options']);
} }

View File

@ -56,7 +56,7 @@ class Locker
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->installationManager = $installationManager; $this->installationManager = $installationManager;
$this->hash = $hash; $this->hash = $hash;
$this->loader = new ArrayLoader(); $this->loader = new ArrayLoader(null, true);
$this->dumper = new ArrayDumper(); $this->dumper = new ArrayDumper();
$this->process = new ProcessExecutor($io); $this->process = new ProcessExecutor($io);
} }

View File

@ -19,7 +19,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
{ {
public function setUp() public function setUp()
{ {
$this->loader = new ArrayLoader(); $this->loader = new ArrayLoader(null, true);
} }
public function testSelfVersion() public function testSelfVersion()