diff --git a/src/Hal/Metric/System/Packages/Composer/Packagist.php b/src/Hal/Metric/System/Packages/Composer/Packagist.php index 30b5a124..4e609583 100644 --- a/src/Hal/Metric/System/Packages/Composer/Packagist.php +++ b/src/Hal/Metric/System/Packages/Composer/Packagist.php @@ -37,8 +37,10 @@ public function get($package) // get latest version $latest = '0.0.0'; foreach ((array)$json->package->versions as $version => $datas) { - $version = preg_replace('([^\.\d])', '', $version); - if (!preg_match('!\d+\.\d+\.\d+!', $version)) { + if ($version[0] === 'v') { + $version = substr($version, 1); + } + if (!preg_match('#^[\.\d]+$#', $version)) { continue; } if ($compare = version_compare($version, $latest) == 1) { diff --git a/src/Hal/Report/Html/template/index.php b/src/Hal/Report/Html/template/index.php index c02ce9b3..d537c695 100644 --- a/src/Hal/Report/Html/template/index.php +++ b/src/Hal/Report/Html/template/index.php @@ -141,7 +141,7 @@ return strcmp($a->name, $b->name); }); foreach ($packages as $package) { ?> - installed && $package->installed !== $package->latest) { echo ' style="color:orangered"'; }?>> + installed && version_compare($package->installed, $package->latest) === -1) { echo ' style="color:orangered"'; }?>> name; ?> required; ?> installed; ?>