#23060 [NEW]: bad logic in php4/pear/PEAR/Dependency.php
| From: | jmcastagnetto@php.net | Date: | Sat, 05 Apr 2003 10:45:23 +0000 |
| Subject: | #23060 [NEW]: bad logic in php4/pear/PEAR/Dependency.php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-14910@lists.php.net to get a copy of this message | ||
From: jmcastagnetto@php.net
Operating system: Red Hat Linux 8.0
PHP version: 4CVS-2003-04-05 (stable)
PHP Bug Type: PEAR related
Bug description: bad logic in php4/pear/PEAR/Dependency.php
I think there is a logic problem in php4/pear/PEAR/Dependency.php The
method "checkPHP()" was checking things incorrectly. According to the
package.dtd (and the code earlier in the 'Dependency' class), that
method gets passed the 'version' and 'rel' attributes of the 'dep'
element,
e.g.:
<dep type="php" rel="ge" version="4.3"/>
but for some reason there was a mix up in the logic of the method's
body.
The "diff -u" output with fixed logic is below:
$ diff -u Dependency.php-orig Dependency.php
--- Dependency.php-orig 2003-04-05 02:43:29.000000000 -0800
+++ Dependency.php 2003-04-05 02:45:11.000000000 -0800
@@ -199,14 +199,15 @@
*/
function checkPHP(&$errmsg, $req, $relation = 'ge')
{
- if (substr($relation, 0, 2) == 'v.') {
- $php_ver = phpversion();
- $operator = substr($relation, 2);
- if (!version_compare("$php_ver", "$req", $operator)) {
- $errmsg = "PHP version " . $this->signOperator($operator)
.
- " $req is required";
- return PEAR_DEPENDENCY_CONFLICT;
- }
+ if (substr($req, 0, 2) == 'v.') {
+ $req = substr($req,2);
+ }
+ $php_ver = phpversion();
+ $operator = substr($relation,0,2);
+ if (!version_compare("$php_ver", "$req", $operator)) {
+ $errmsg = "PHP version " . $this->signOperator($operator) .
+ " $req is required";
+ return PEAR_DEPENDENCY_CONFLICT;
}
return false;
}
--
Edit bug report at http://bugs.php.net/?id=23060&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23060&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23060&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23060&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23060&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23060&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23060&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23060&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23060&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23060&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23060&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23060&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23060&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23060&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23060&r=gnused