From 0dd84bb27540dab3deacf2a238ac59125c0c245c Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Mon, 28 May 2007 15:26:26 +0000 Subject: [PATCH] - Notice about missing class file when using pack -p optional --- ext/phar/phar/clicommand.inc | 7 ++++++- ext/phar/phar/pharcommand.inc | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc index 3b7934c3c2..b000571687 100755 --- a/ext/phar/phar/clicommand.inc +++ b/ext/phar/phar/clicommand.inc @@ -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); } diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 3b69dec376..35dae64622 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -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; } -- 2.50.1