From: Marcus Boerger Date: Wed, 4 Jun 2008 09:46:34 +0000 (+0000) Subject: - Improve pear usage and PHP_Archive detection X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~76 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=350824478b5fe60ecd499457eac451a2cb83a8c0;p=php - Improve pear usage and PHP_Archive detection --- diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 7c7043c1ef..2738e2a658 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -209,13 +209,18 @@ class PharCommand extends CLICommand { if (($arg == '0' || $arg == '1') && !file_exists($arg)) { $found = NULL; - foreach(split("\n", `pear list-files PHP_Archive`) as $ent) { - $matches = NULL; - if (preg_match(",^php[ \t]+([^ \t].*pear[\\\\/]PHP[\\\\/]Archive.php)$,", $ent, $matches)) { - $found = $matches[1]; - break; - } - } + $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`; + $apiver = trim(substr($apiver, strlen('API Version'))); + if ($apiver) { + self::notice("Pear package PHP_Archive found: API Version: $apiver.\n"); + foreach(split("\n", `pear list-files PHP_Archive`) as $ent) { + $matches = NULL; + if (preg_match(",^php[ \t]+([^ \t].*pear[\\\\/]PHP[\\\\/]Archive.php)$,", $ent, $matches)) { + $found = $matches[1]; + break; + } + } + } if (!isset($found)) { $msg = "Pear package PHP_Archive or Archive.php class file not found.\n"; if ($arg == '0') {