Skip to content

Commit

Permalink
Add warning for extra awareness about dangers of requiring anything, f…
Browse files Browse the repository at this point in the history
…ixes #12312 (#12319)
  • Loading branch information
Seldaek authored Feb 19, 2025
1 parent da63c30 commit bc4bc73
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Composer/DependencyResolver/Problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ public static function getMissingPackageReason(RepositorySet $repositorySet, Req
if (null === $version) {
$providersStr = self::getProvidersList($repositorySet, $packageName, 5);
if ($providersStr !== null) {
$providersStr = "\n\n Alternatively you can require one of these packages that provide the extension (or parts of it):\n$providersStr";
$providersStr = "\n\n Alternatively you can require one of these packages that provide the extension (or parts of it):\n".
" <warning>Keep in mind that the suggestions are automated and may not be valid or safe to use</warning>\n$providersStr";
}

if (extension_loaded($ext)) {
Expand All @@ -306,7 +307,8 @@ public static function getMissingPackageReason(RepositorySet $repositorySet, Req

$providersStr = self::getProvidersList($repositorySet, $packageName, 5);
if ($providersStr !== null) {
$providersStr = "\n\n Alternatively you can require one of these packages that provide the library (or parts of it):\n$providersStr";
$providersStr = "\n\n Alternatively you can require one of these packages that provide the library (or parts of it):\n".
" <warning>Keep in mind that the suggestions are automated and may not be valid or safe to use</warning>\n$providersStr";
}

return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', 'it has the wrong version installed or is missing from your system, make sure to load the extension providing it.'.$providersStr];
Expand Down

0 comments on commit bc4bc73

Please sign in to comment.