summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2008-08-01 05:43:09 +0000
committerMarcus Boerger <helly@php.net>2008-08-01 05:43:09 +0000
commitd29fba1678c8f88a66806834ed5b7d5b7c8b155e (patch)
tree6120fb678695930628b533004506cd6469835f6a
parentfe0e4c260685dab5617449703485f63cc0b152a7 (diff)
downloadphp-git-d29fba1678c8f88a66806834ed5b7d5b7c8b155e.tar.gz
- Fix pear PHP_Archive class file location
-rwxr-xr-xext/phar/phar/pharcommand.inc41
1 files changed, 28 insertions, 13 deletions
diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc
index 4638afc343..67e1dbe594 100755
--- a/ext/phar/phar/pharcommand.inc
+++ b/ext/phar/phar/pharcommand.inc
@@ -209,19 +209,34 @@ class PharCommand extends CLICommand
{
if (($arg == '0' || $arg == '1') && !file_exists($arg)) {
$found = NULL;
- $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)) {
+ $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: API Version: $apiver.\n");
+ $files = split("\n", `pear list-files PHP_Archive`);
+ $phpdir = `pear config-get php_dir 2>/dev/null`;
+ $phpdir = trim($phpdir);
+ self::notice("Pear package PHP_Archive: $phpdir.\n");
+ if (is_dir($phpdir)) {
+ foreach($files as $ent) {
+ $matches = NULL;
+ if (preg_match(",^php[ \t]+([^ \t].*[\\\\/]PHP[\\\\/]Archive\.php)$,", $ent, $matches)) {
+ $sub = $matches[1];
+ if (strpos($sub, $phpdir) !== 0) {
+ $found = NULL;
+ break;
+ }
+ $found = $sub;
+ break;
+ }
+ }
+ } else {
+ self::notice("Pear package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n");
+ }
+ }
+ if (isset($found)) {
+ self::notice("Pear package PHP_Archive: $found.\n");
+ } else {
$msg = "Pear package PHP_Archive or Archive.php class file not found.\n";
if ($arg == '0') {
self::notice($msg);