From ae922eaf4cba47cff22c804ae8b81f174342ba39 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 8 Jun 2011 11:41:52 +0200 Subject: [PATCH] Use ReflectionExtension to read ext versions --- src/Composer/Repository/PlatformRepository.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 2e784e24d..92c4662ce 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -36,8 +36,15 @@ class PlatformRepository extends ArrayRepository if (in_array($ext, array('standard', 'Core'))) { continue; } - // TODO maybe we could parse versions from phpinfo(INFO_MODULES) - $ext = new MemoryPackage('ext/'.strtolower($ext), '0', 'stable'); + + $reflExt = new \ReflectionExtension($ext); + try { + $version = BasePackage::parseVersion($reflExt->getVersion()); + } catch (\UnexpectedValueException $e) { + $version = array('version' => '0', 'type' => 'stable'); + } + + $ext = new MemoryPackage('ext/'.strtolower($ext), $version['version'], $version['type']); $this->addPackage($ext); } }