]> granicus.if.org Git - php/commitdiff
- Notice about missing class file when using pack -p optional
authorMarcus Boerger <helly@php.net>
Mon, 28 May 2007 15:26:26 +0000 (15:26 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 28 May 2007 15:26:26 +0000 (15:26 +0000)
ext/phar/phar/clicommand.inc
ext/phar/phar/pharcommand.inc

index 3b7934c3c2d4b2583d205f2d1537ff4c74b133fc..b000571687fa67558de049c9ff1a4d1e8dada688 100755 (executable)
@@ -86,9 +86,14 @@ abstract class CLICommand
         call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
     }
 
-    static function error ($msg, $exit_code = 1) 
+    static function notice ($msg)
     {
         fprintf(STDERR, $msg);
+    }
+
+    static function error ($msg, $exit_code = 1) 
+    {
+        notice($msg);
         exit($exit_code);
     }
 
index 3b69dec376cbef49df3e79fbe4e0b98f5ab330ef..35dae64622fb6d6a1d5b679775c6db4b8510e4bc 100755 (executable)
@@ -180,8 +180,8 @@ class PharCommand extends CLICommand
     /**
      * Argument type loader
      *
-     * @param string $arg   Either 'auto' or an filename that contains class 
-     *                      PHP_Archive
+     * @param string $arg   Either 'auto', 'optional' or an filename that 
+     *                      contains class PHP_Archive
      * @param  string $cfg  Configuration to pass to a new file
      * @param  string $key  The key 
      * @return string $arg  The argument.
@@ -197,8 +197,13 @@ class PharCommand extends CLICommand
                     break;
                 }
             }
-            if (!isset($found) && $arg != 'optional') {
-                self::error("Pear package PHP_Archive or Archive.php class file not found.\n");
+            if (!isset($found)) {
+               $msg = "Pear package PHP_Archive or Archive.php class file not found.\n";
+               if ($arg == 'optional') {
+                       self::notice($msg);
+               } else {
+                       self::error($msg);
+               }
             }
             $arg = $found;
         }