Fix extension parsing to take the most usable data instead of just using 0 in case of parsing failure, fixes #5331, fixes #5264
parent
8f0324f51e
commit
0cca4d1a44
|
@ -94,19 +94,25 @@ class PlatformRepository extends ArrayRepository
|
||||||
if (in_array($name, array('standard', 'Core'))) {
|
if (in_array($name, array('standard', 'Core'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$extraDescription = null;
|
||||||
|
|
||||||
$reflExt = new \ReflectionExtension($name);
|
$reflExt = new \ReflectionExtension($name);
|
||||||
try {
|
try {
|
||||||
$prettyVersion = $reflExt->getVersion();
|
$prettyVersion = $reflExt->getVersion();
|
||||||
$version = $versionParser->normalize($prettyVersion);
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
$extraDescription = ' (actual version: '.$prettyVersion.')';
|
||||||
|
if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
|
||||||
|
$prettyVersion = $match[1];
|
||||||
|
} else {
|
||||||
$prettyVersion = '0';
|
$prettyVersion = '0';
|
||||||
|
}
|
||||||
$version = $versionParser->normalize($prettyVersion);
|
$version = $versionParser->normalize($prettyVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
$packageName = $this->buildPackageName($name);
|
$packageName = $this->buildPackageName($name);
|
||||||
$ext = new CompletePackage($packageName, $version, $prettyVersion);
|
$ext = new CompletePackage($packageName, $version, $prettyVersion);
|
||||||
$ext->setDescription('The '.$name.' PHP extension');
|
$ext->setDescription('The '.$name.' PHP extension' . $extraDescription);
|
||||||
$this->addPackage($ext);
|
$this->addPackage($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue