]> granicus.if.org Git - php/commitdiff
fix slightly unclear error message in generation of phar.phar
authorGreg Beaver <cellog@php.net>
Wed, 24 Jun 2009 22:12:47 +0000 (22:12 +0000)
committerGreg Beaver <cellog@php.net>
Wed, 24 Jun 2009 22:12:47 +0000 (22:12 +0000)
NEWS
ext/phar/phar/pharcommand.inc

diff --git a/NEWS b/NEWS
index 9bd608a4a0e75c2028f937de826c65e191447cab..25e69faa018ab8c728ed4f714656f2d3eb1bf67a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2009, PHP 5.3.0 RC 5
+- Fixed slightly unclear message in generation of phar.phar. (Greg+others)
 - Fixed memory leak in json_decode() when depth is less than 0. (Felipe)
 
 - Fixed bug #48643 (String functions memory issue). (Dmitry)
index e50637b24124b4774e94f45fc2e65b9996df5718..9a111b8d83b18124f6fcfe7cc3b649b23f08f0c6 100755 (executable)
@@ -210,16 +210,28 @@ class PharCommand extends CLICommand
         */
        static function cli_arg_typ_loader($arg, $cfg, $key)
        {
-               if (($arg == '0' || $arg == '1') && !file_exists($arg)) {
+               if (($arg == '0' || $arg == '1') && !file_exists($arg) && substr(PHP_OS, 0, 3) != 'WIN') {
                        $found = NULL;
-                       $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`;
-                       $apiver = trim(substr($apiver, strlen('API Version')));
+                       $apiver = false;
+                       $path = explode(PATH_SEPARATOR, $_ENV['PATH']);
+                       $pear = false;
+                       foreach ($path as $component) {
+                               if (file_exists($component . DIRECTORY_SEPARATOR . 'pear')
+                                       && is_executable($component . DIRECTORY_SEPARATOR . 'pear')) {
+                                       $pear = true;
+                                       break;
+                               }
+                       }
+                       if ($pear) {
+                               $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");
+                               self::notice("PEAR package PHP_Archive: API Version: $apiver.\n");
                                $files  = explode("\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");
+                               self::notice("PEAR package PHP_Archive: $phpdir.\n");
                                if (is_dir($phpdir)) {
                                        foreach($files as $ent) {
                                                $matches = NULL;
@@ -234,13 +246,13 @@ class PharCommand extends CLICommand
                                                }
                                        }
                                } else {
-                                       self::notice("Pear package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n");
+                                       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");
+                               self::notice("PEAR package PHP_Archive: $found.\n");
                        } else {
-                               $msg = "Pear package PHP_Archive or Archive.php class file not found.\n";
+                               $msg = "PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.\n";
                                if ($arg == '0') {
                                        self::notice($msg);
                                } else {