]> granicus.if.org Git - php/commitdiff
Test first if the package exists before comparing the version
authorTomas V.V.Cox <cox@php.net>
Wed, 22 May 2002 01:23:12 +0000 (01:23 +0000)
committerTomas V.V.Cox <cox@php.net>
Wed, 22 May 2002 01:23:12 +0000 (01:23 +0000)
(fix the version_compare() segfault)

pear/PEAR/Dependency.php

index 4afe9b8671ef3ab9433c57c81df3e25c384369ea..74debb540bd945bf131817b1e019829ae8f3e9b8 100644 (file)
@@ -111,9 +111,11 @@ class PEAR_Dependency
             case 'ge':
             case 'gt':
                 $version = $this->registry->packageInfo($name, 'version');
-                if (!version_compare($version, $req, $relation)) {
+                if (!$this->registry->packageExists($name)
+                    || !version_compare($version, $req, $relation))
+                {
                     return "requires package `$name' " .
-                        $this->signOperator($relation) . " $req";
+                           $this->signOperator($relation) . " $req";
                 }
         }
         return "Relation '$relation' with requirement '$req' is not supported (name=$name)";