From: Tomas V.V.Cox Date: Wed, 22 May 2002 01:23:12 +0000 (+0000) Subject: Test first if the package exists before comparing the version X-Git-Tag: RELEASE_0_10~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae126450c9b44ce589e1dca5bed312e94ea71228;p=php Test first if the package exists before comparing the version (fix the version_compare() segfault) --- diff --git a/pear/PEAR/Dependency.php b/pear/PEAR/Dependency.php index 4afe9b8671..74debb540b 100644 --- a/pear/PEAR/Dependency.php +++ b/pear/PEAR/Dependency.php @@ -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)";