{"action":"opened","issue":{"url":"https://api.github.com/repos/composer/composer/issues/4181","labels_url":"https://api.github.com/repos/composer/composer/issues/4181/labels{/name}","comments_url":"https://api.github.com/repos/composer/composer/issues/4181/comments","events_url":"https://api.github.com/repos/composer/composer/issues/4181/events","html_url":"https://github.com/composer/composer/issues/4181","id":91199096,"number":4181,"title":"VersionSelector::findBestCandidate() doesn't take into account already installed packages","user":{"login":"sminnee","id":59968,"avatar_url":"https://avatars.githubusercontent.com/u/59968?v=3","gravatar_id":"","url":"https://api.github.com/users/sminnee","html_url":"https://github.com/sminnee","followers_url":"https://api.github.com/users/sminnee/followers","following_url":"https://api.github.com/users/sminnee/following{/other_user}","gists_url":"https://api.github.com/users/sminnee/gists{/gist_id}","starred_url":"https://api.github.com/users/sminnee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sminnee/subscriptions","organizations_url":"https://api.github.com/users/sminnee/orgs","repos_url":"https://api.github.com/users/sminnee/repos","events_url":"https://api.github.com/users/sminnee/events{/privacy}","received_events_url":"https://api.github.com/users/sminnee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-26T09:13:56Z","updated_at":"2015-06-26T09:13:56Z","closed_at":null,"body":"It's great that `composer require` no longer requires that you provide a version, and instead makes an educated guess.\r\n\r\nHowever, the current logic is a bit limited when you're have multiple versions of a package, and only some of those will be compatible with already installed packages.\r\n\r\nFor example, we might have:\r\n\r\n * silverstripe/translatable 2.1 works with silverstripe/framework 3.2\r\n * silverstripe/translatable 3.0 works with silverstripe/framework 4.0\r\n\r\nIf framework 3.2 is included and you try and install silverstripe/translatable, it will detect 3.0 as the most recent version and try and install that.\r\n\r\nTo fix this, I think the candidates selected in https://github.com/composer/composer/blob/master/src/Composer/Package/Version/VersionSelector.php#L48 should be filtered to only include candidates that are compatible with the currently installed packages."}}