Prechádzať zdrojové kódy

Print details about missing extensions, fixes #312

Jordi Boggiano 13 rokov pred
rodič
commit
5fd50080ab

+ 6 - 0
src/Composer/DependencyResolver/Problem.php

@@ -75,6 +75,12 @@ class Problem
             $job = $reason['job'];
 
             if ($job && $job['cmd'] === 'install' && empty($job['packages'])) {
+                // handle php extensions
+                if (0 === stripos($job['packageName'], 'ext-')) {
+                    $ext = substr($job['packageName'], 4);
+                    $error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
+                    return 'The requested PHP extension "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).$error.'.';
+                }
                 return 'The requested package "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).'could not be found.';
             }
         }