Browse Source

Show defaulted version if phpversion() returns nothing, fixes #2313

Jordi Boggiano 12 years ago
parent
commit
cc37e4b0b8

+ 1 - 1
src/Composer/DependencyResolver/Problem.php

@@ -84,7 +84,7 @@ class Problem
                 // 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';
+                    $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
 
                     return "\n    - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'.';
                 }

+ 1 - 1
src/Composer/DependencyResolver/Rule.php

@@ -215,7 +215,7 @@ class Rule
                     // handle php extensions
                     if (0 === strpos($targetName, 'ext-')) {
                         $ext = substr($targetName, 4);
-                        $error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
+                        $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
 
                         $text .= ' -> the requested PHP extension '.$ext.' '.$error.'.';
                     } elseif (0 === strpos($targetName, 'lib-')) {