From 52888f193d95d7c93962351a25a88c6f886b3250 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 8 Jun 2011 17:47:34 +0200 Subject: [PATCH] Fix version parsing of PHP on some linux distros --- src/Composer/Repository/PlatformRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 92c4662ce..6b897229d 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -26,7 +26,11 @@ class PlatformRepository extends ArrayRepository { parent::initialize(); - $version = BasePackage::parseVersion(PHP_VERSION); + try { + $version = BasePackage::parseVersion(PHP_VERSION); + } catch (\UnexpectedValueException $e) { + $version = BasePackage::parseVersion(preg_replace('#^(.+?)(-.+)?#', '$1', PHP_VERSION)); + } // TODO mark as type platform and create a special installer that skips it + one that throws an exception $php = new MemoryPackage('php', $version['version'], $version['type']);