Skip to content
Snippets Groups Projects

Issue #3320558: When parsing releases, place ProjectRelease::createFromArray in a try block

Merged Issue #3320558: When parsing releases, place ProjectRelease::createFromArray in a try block
1 unresolved thread
1 unresolved thread
Files
3
@@ -8,6 +8,7 @@ use Composer\Semver\Comparator;
@@ -8,6 +8,7 @@ use Composer\Semver\Comparator;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\update\ProjectRelease;
use Drupal\update\ProjectRelease;
use Drupal\Core\Extension\ExtensionVersion;
use Drupal\Core\Extension\ExtensionVersion;
 
use Drupal\Core\Utility\Error;
use Drupal\update\UpdateManagerInterface;
use Drupal\update\UpdateManagerInterface;
/**
/**
@@ -120,7 +121,17 @@ final class ProjectInfo {
@@ -120,7 +121,17 @@ final class ProjectInfo {
$support_branches = explode(',', $available_updates['supported_branches']);
$support_branches = explode(',', $available_updates['supported_branches']);
$installable_releases = [];
$installable_releases = [];
foreach ($available_updates['releases'] as $release_info) {
foreach ($available_updates['releases'] as $release_info) {
$release = ProjectRelease::createFromArray($release_info);
try {
 
$release = ProjectRelease::createFromArray($release_info);
 
}
 
catch (\UnexpectedValueException $exception) {
 
// Ignore releases that are in an invalid format. Although this is
 
// unlikely we should still only process releases in the correct format.
 
\Drupal::logger('package_manager')
 
->error(sprintf('Invalid project format: %s', print_r($release_info, TRUE)), Error::decodeException($exception));
 
continue;
 
}
 
$version = $release->getVersion();
$version = $release->getVersion();
if ($installed_version) {
if ($installed_version) {
$semantic_version = LegacyVersionUtility::convertToSemanticVersion($version);
$semantic_version = LegacyVersionUtility::convertToSemanticVersion($version);
Loading