{"action":"created","issue":{"url":"https://api.github.com/repos/composer/composer/issues/4451","labels_url":"https://api.github.com/repos/composer/composer/issues/4451/labels{/name}","comments_url":"https://api.github.com/repos/composer/composer/issues/4451/comments","events_url":"https://api.github.com/repos/composer/composer/issues/4451/events","html_url":"https://github.com/composer/composer/issues/4451","id":108405383,"number":4451,"title":"composer update throws InvalidArgumentException when using 'path' type repository","user":{"login":"juanpescador","id":1808374,"avatar_url":"https://avatars.githubusercontent.com/u/1808374?v=3","gravatar_id":"","url":"https://api.github.com/users/juanpescador","html_url":"https://github.com/juanpescador","followers_url":"https://api.github.com/users/juanpescador/followers","following_url":"https://api.github.com/users/juanpescador/following{/other_user}","gists_url":"https://api.github.com/users/juanpescador/gists{/gist_id}","starred_url":"https://api.github.com/users/juanpescador/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanpescador/subscriptions","organizations_url":"https://api.github.com/users/juanpescador/orgs","repos_url":"https://api.github.com/users/juanpescador/repos","events_url":"https://api.github.com/users/juanpescador/events{/privacy}","received_events_url":"https://api.github.com/users/juanpescador/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/composer/composer/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/composer/composer/labels/Support","name":"Support","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-25T20:49:48Z","updated_at":"2015-09-28T10:32:02Z","closed_at":null,"body":"With a 'path' type repository, defined as following in the project's `composer.json`:\r\n\r\n    ...\r\n    \"repositories\": [\r\n        {\r\n            \"type\": \"composer\",\r\n            \"url\": \"http://wpackagist.org\"\r\n        },\r\n        {\r\n            \"type\": \"path\",\r\n            \"url\": \"../private-packages/theme/\"\r\n        }\r\n    ],\r\n    \"require\": {\r\n        \"php\": \">=5.5\",\r\n        \"composer/installers\": \"~1.0.12\",\r\n        \"vlucas/phpdotenv\": \"^2.0.1\",\r\n        \"johnpbloch/wordpress\": \"4.3\",\r\n        \"vendor/theme\": \"1.0.0\"\r\n    },\r\n    \"extra\": {\r\n        \"installer-paths\": {\r\n            \"web/app/mu-plugins/{$name}/\": [\"type:wordpress-muplugin\"],\r\n            \"web/app/plugins/{$name}/\": [\"type:wordpress-plugin\"],\r\n            \"web/app/themes/{$name}/\": [\"type:wordpress-theme\"]\r\n        },\r\n        \"wordpress-install-dir\": \"web/wp\"\r\n    }\r\n    ...\r\n\r\nI'm getting an error message when running `composer update`, during installation of a `wordpress-theme` type package, both from Windows and from Linux. The message is<sup>1</sup>:\r\n\r\n    [InvalidArgumentException]\r\n      $from (web/app/themes/theme/) and $to (/vagrant/private-packages/theme) must\r\n      be absolute paths.\r\n    Exception trace:\r\n     () at phar:///usr/lib/composer/composer.phar/src/Composer/Util/Filesystem.php:312\r\n     Composer\\Util\\Filesystem->findShortestPath() at phar:///usr/lib/composer/composer.phar/src/Composer/Downloader/PathDownloader.php:51\r\n     Composer\\Downloader\\PathDownloader->download() at phar:///usr/lib/composer/composer.phar/src/Composer/Downloader/DownloadManager.php:201\r\n     Composer\\Downloader\\DownloadManager->download() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer/LibraryInstaller.php:156\r\n     Composer\\Installer\\LibraryInstaller->installCode() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer/LibraryInstaller.php:87\r\n     Composer\\Installer\\LibraryInstaller->install() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer/InstallationManager.php:152\r\n     Composer\\Installer\\InstallationManager->install() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer/InstallationManager.php:139\r\n     Composer\\Installer\\InstallationManager->execute() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer.php:600\r\n     Composer\\Installer->doInstall() at phar:///usr/lib/composer/composer.phar/src/Composer/Installer.php:233\r\n     Composer\\Installer->run() at phar:///usr/lib/composer/composer.phar/src/Composer/Command/UpdateCommand.php:143\r\n     Composer\\Command\\UpdateCommand->execute() at phar:///usr/lib/composer/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257\r\n     Symfony\\Component\\Console\\Command\\Command->run() at phar:///usr/lib/composer/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874\r\n     Symfony\\Component\\Console\\Application->doRunCommand() at phar:///usr/lib/composer/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195\r\n     Symfony\\Component\\Console\\Application->doRun() at phar:///usr/lib/composer/composer.phar/src/Composer/Console/Application.php:147\r\n     Composer\\Console\\Application->doRun() at phar:///usr/lib/composer/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126\r\n     Symfony\\Component\\Console\\Application->run() at phar:///usr/lib/composer/composer.phar/src/Composer/Console/Application.php:82\r\n     Composer\\Console\\Application->run() at phar:///usr/lib/composer/composer.phar/bin/composer:43\r\n     require() at /usr/lib/composer/composer.phar:25\r\n\r\nThe error is throwing from [findShortestPath()][FindShortestPathErrorSource]; the `$from` path seems to incorrectly be passed in as relative instead of absolute.\r\n\r\nChanging the repository type to 'artifact', zipping the `theme` package and changing the `url` property to the correct directory results in a successful `composer update`; the theme ends up in `web/app/themes/theme`.\r\n\r\nIf this is low-hanging fruit I could attempt a fix over the weekend if you can point me in the right direction, though I don't have a PHP development environment set up.\r\n\r\n## Appendix\r\n\r\nI don't think it's relevant, as the package installs correctly with the artifact repository type, but here's the package's `composer.json`:\r\n\r\n    {\r\n        \"name\": \"vendor/theme\",\r\n        \"version\": \"1.0.0\",\r\n        \"type\": \"wordpress-theme\",\r\n        \"description\": \"A private WordPress theme.\"\r\n    }\r\n\r\n<sup>1</sup>On Windows the `/vagrant/private-packages/theme` absolute path is replaced with the Windows equivalent, so I don't think it's a platform issue.\r\n\r\n[FindShortestPathErrorSource]: https://github.com/composer/composer/blob/e8d84a1a296057e197579eff5287debdbb406ca4/src/Composer/Util/Filesystem.php#L312\r\n[RootsBedrock]: https://github.com/roots/bedrock/blob/master/composer.json"},"comment":{"url":"https://api.github.com/repos/composer/composer/issues/comments/143703332","html_url":"https://github.com/composer/composer/issues/4451#issuecomment-143703332","issue_url":"https://api.github.com/repos/composer/composer/issues/4451","id":143703332,"user":{"login":"antzhdanov","id":1424394,"avatar_url":"https://avatars.githubusercontent.com/u/1424394?v=3","gravatar_id":"","url":"https://api.github.com/users/antzhdanov","html_url":"https://github.com/antzhdanov","followers_url":"https://api.github.com/users/antzhdanov/followers","following_url":"https://api.github.com/users/antzhdanov/following{/other_user}","gists_url":"https://api.github.com/users/antzhdanov/gists{/gist_id}","starred_url":"https://api.github.com/users/antzhdanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antzhdanov/subscriptions","organizations_url":"https://api.github.com/users/antzhdanov/orgs","repos_url":"https://api.github.com/users/antzhdanov/repos","events_url":"https://api.github.com/users/antzhdanov/events{/privacy}","received_events_url":"https://api.github.com/users/antzhdanov/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T10:32:02Z","updated_at":"2015-09-28T10:32:02Z","body":"I think we could just make sure we work with absolute paths before https://github.com/composer/composer/blob/master/src/Composer/Downloader/PathDownloader.php#L51\r\nIf agree, I have a working example that I can turn into pull request."}}