php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25080 packages with optional dependencies can't be uninstalled
Submitted: 2003-08-13 16:14 UTC Modified: 2003-08-13 16:16 UTC
From: cellog@php.net Assigned:
Status: Closed Package: PEAR related
PHP Version: Irrelevant OS: na
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cellog@php.net
New email:
PHP Version: OS:

 

 [2003-08-13 16:14 UTC] cellog@php.net
Description:
------------
if a package has an optional dependency, it can't be uninstalled if the optional dependency is installed.  This patch fixes that

Index: pear/PEAR/Dependency.php
===================================================================
RCS file: /repository/php-src/pear/PEAR/Dependency.php,v
retrieving revision 1.23
diff -u -r1.23 Dependency.php
--- pear/PEAR/Dependency.php	3 Aug 2003 13:44:36 -0000	1.23
+++ pear/PEAR/Dependency.php	13 Aug 2003 21:13:31 -0000
@@ -151,11 +151,12 @@
      * Check package dependencies on uninstall
      *
      * @param string $error     The resultant error string
+     * @param string $warning   The resultant warning string
      * @param string $name      Name of the package to test
      *
      * @return bool true if there were errors
      */
-    function checkPackageUninstall(&$error, $package)
+    function checkPackageUninstall(&$error, &$warning, $package)
     {
         $error = null;
         $packages = $this->registry->listPackages();
@@ -169,7 +170,11 @@
             }
             foreach ($deps as $dep) {
                 if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) {
-                    $error .= "Package '$pkg' depends on '$package'\n";
+                    if (isset($dep['optional']) && $dep['optional'] == 'yes') {
+                        $warning .= "\nWarning: Package '$pkg' optionally depends on '$package'";
+                    } else {
+                        $error .= "Package '$pkg' depends on '$package'\n";
+                    }
                 }
             }
         }



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-13 16:16 UTC] cellog@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Forgot this additional patch to Installer.php


Index: pear/PEAR/Installer.php
===================================================================
RCS file: /repository/php-src/pear/PEAR/Installer.php,v
retrieving revision 1.95
diff -u -r1.95 Installer.php
--- pear/PEAR/Installer.php	5 Aug 2003 14:31:15 -0000	1.95
+++ pear/PEAR/Installer.php	13 Aug 2003 21:15:46 -0000
@@ -774,11 +774,18 @@
             $this->installroot = '';
         }
         $this->registry = &new PEAR_Registry($php_dir);
+        $filelist = $this->registry->packageInfo($package, 'filelist');
+        if ($filelist == null) {
+            return $this->raiseError("$package not installed");
+        }
         if (empty($options['nodeps'])) {
             $depchecker = &new PEAR_Dependency($this->registry);
-            $error = $depchecker->checkPackageUninstall($errors, $package);
+            $error = $depchecker->checkPackageUninstall($errors, $warning, $package);
             if ($error) {
                 return $this->raiseError($errors . 'uninstall failed');
+            }
+            if ($warning) {
+                $this->log(0, $warning);
             }
         }
         // Delete the files

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 06:01:30 2024 UTC